WordPress.org

Ready to get started?Download WordPress

Forums

Filtering Loop (2 posts)

  1. bobemil
    Member
    Posted 1 year ago #

    I don't get how to achieve a filtering function with wp_query. I have three links on top of my loop to let the user choose between showing 25, 40 or 80 posts per page. I don't get how to make the clicked link fire the function to show the amount in the loop. Sorry for my bad english. If you don't understand I will explain it better. Please help me with this one :)

  2. vtxyzzy
    Member
    Posted 1 year ago #

    The links need to call the page with the proper number as an argument to the link, something like this:

    <a href="http://mysite.com/my-page/?perpage=25

    Then in the code for the template check for the perpage argument and re-issue the query using that as the posts_per_page value.

    You will also need to alter the links generated by the pagination to include the perpage value in order to pass it along to all subsequent pages.

    The exact coding is probably too involved for this forum. You can post a job request on jobs.wordpress.net at no cost.

Topic Closed

This topic has been closed to new replies.

About this Topic