WordPress Load More Post via button click
-
I’m relatively new to WordPress. So this might not be the best approach, or even possible. With that said, I’m open to better solution.
I have a homepage that will display the latest 12 posts.
I want to make a button that when clicked will load the next 4.What I have currently is this:
<?php query_posts('showposts=4&offset=12'); ?> <?php while (have_posts()): the_post(); ?> //some html tags <?php endwhile; ?>
This will load me the detail of post 13-16.
I’m looking for a way where I can put this in a function and then call it through a jquery click() event where I can use a counter of some sort for the offset. something like
var offSetCounter = 12; $(".btnLoadMore").click(function(){ //php function call loadmore(offSetCounter); offSetCounter += 4; });
So next time i click the button the offSetCounter would be 16 and so on.
Thanks in Advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘WordPress Load More Post via button click’ is closed to new replies.