Allow User to customize posts per page via links on page
-
Hello,
I’m trying to build a list of links at the bottom of an archive page to allow a user to expand the number of posts_per_page.
By default, I’ve modified my WP_Query to show 15 posts per page.
I’d like to allow viewers of the site to click a link at the bottom to expand to view 20, 30, 40, 50 posts per page.
How would I modify my WP_Query to read a passed in variable like that? I tried using a link with a GET command:
<a href="www.blogurl.com/category/?numposts=20">show 20 posts per page</a>
then set my WP_Query with a variable like this:
if (!$numposts) $numposts = 15; $args = array ('posts_per_page' => $numposts); $my_query = new WP_Query($args);
But that didn’t work.
Anyone ever set something like this up?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Allow User to customize posts per page via links on page’ is closed to new replies.