Select archive post per page amt with dropdown 10 | 20 | view all
-
I am interested in being able to let the reader of my blog change the amount of posts on an archive page.
For example: above the list of archived posts there would be this menu:
10 per page | 50 per page | view allI have been playing around with it today – and have made it work for my categories archives (I am eventually going to add in the other archive options – but I wanted to work it out first) :
Here is the code: At pastebin
(the template tag for archive.php is commented out at the bottom)I have two questions – Is this a smart way to do this? Is there an easier way?
And also how would I make the options look like links (not a drop down?) I have been playing with changing them to form buttons but I think the jquery input values are a bit above my current skills.
My latest attempt :
<form id="amt-per" action=""> <input type="submit" value="20"> <input type="submit" value="50" > <input type="submit" value="all"> </select> <script type="text/javascript"> $("button").click(function () { var str = $(this).text(); window.location.href = "<?php echo site_url(); ?>/<?php echo $taxy ?>/<?php echo $archivetype ?>/?a="+str; }); </script>
Any insights would be appreciated!
- The topic ‘Select archive post per page amt with dropdown 10 | 20 | view all’ is closed to new replies.