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

admin2025-06-02  1

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.
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748855611a314284.html

最新回复(0)