$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>paginate links - Why does paginate_links() reload the entire page? and can you make it reload only a specific div?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

paginate links - Why does paginate_links() reload the entire page? and can you make it reload only a specific div?

matteradmin7PV0评论

Beginner here; apologise for any obvious mistakes.

I have a post list on my homepage showing 3 posts at a time and using paginate_links().

When I click on page2 or next in the paginate_links(), it reloads the entire homepage(and scrolls to the top of page.

Need to scroll down back to post list) and then the page2 of the post list is shown.

My homepage has a lot of other content; so is there a way for paginate_links() to work by reloading only the post lists instead of the entire page?

Beginner here; apologise for any obvious mistakes.

I have a post list on my homepage showing 3 posts at a time and using paginate_links().

When I click on page2 or next in the paginate_links(), it reloads the entire homepage(and scrolls to the top of page.

Need to scroll down back to post list) and then the page2 of the post list is shown.

My homepage has a lot of other content; so is there a way for paginate_links() to work by reloading only the post lists instead of the entire page?

Share Improve this question edited Feb 28, 2019 at 7:29 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Feb 28, 2019 at 7:25 N3moN3mo 115 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

pageinate_links is a function that retrieves paginated link for archive post pages.

So yes - there are links. And links works exactly this way - if you click on it, you will go to the url that is connected with that link - so the page will get reloaded.

If you want the link to cause a partial reload of only one div (or other container), you'll have to write your own code, that will:

  1. Prevent the link reloading the page when clicked.
  2. Send AJAX request to the server and obtain new content of that container.
  3. Replace the content of container with the new content received from server.
Post a comment

comment list (0)

  1. No comments so far