- This topic is empty.
-
AuthorPosts
-
October 3, 2011 at 1:24 pm #34615vnvillarParticipant
Hello again, Guys!
Hope you’re all having a grand time. I wanted to have a pagination on a custom query that I wanted to show at the bottom of my homepage. Any ideas guys on how to do this? Please see attached link of my design that I wanted to look like
Thank you advance :)
All the best,
Val
October 3, 2011 at 2:24 pm #88387October 3, 2011 at 2:42 pm #88388vnvillarParticipantThank you TheDoc! I did stumbled upon that blog and I can’t seem to understand it (forgive me I’m not that advance in WordPress :D )
Here’s the code I’m using in my index.php file
query('cat=5&showposts=10'); ?>
have_posts()) : $recent->the_post(); ?>
Can you tell me how it should it be?
Thank you so much :)
Val
October 3, 2011 at 4:06 pm #88390TheDocMemberBased on your image you would have to do something like this for your query:
'posts_per_page' => 6,
'paged' => get_query_var('paged')
);
query_posts( $args ); ?>
And then you’ll need to add in the pagination after your endwhile.
October 4, 2011 at 1:21 am #88429vnvillarParticipantAh.. ok will try the code and will let you know the output. Thanks TheDoc! :)
October 4, 2011 at 5:48 am #88441vnvillarParticipantHi TheDoc,
I tried using the code you gave me, also added post navigation link, but the pagination doesn’t seems to be working?
Here’s the code snippet:
'posts_per_page' => 3,
'paged' => get_query_var('paged')
);
query_posts( $args ); ?>
">
Am I missing something?
Thanks!
Val
October 4, 2011 at 1:55 pm #88494TheDocMemberWhat happens when you click ‘next’?
October 4, 2011 at 2:14 pm #88496vnvillarParticipantIt just displays the same posts :| but I can see the site url changed to ?page=2 though. Am I missing anything?
October 4, 2011 at 2:24 pm #88497TheDocMemberInstead of:
'paged' => get_query_var('paged')
…try:
'paged' => get_query_var('page')
October 5, 2011 at 3:17 am #88524vnvillarParticipantOk got it. Will update you the output :)
Thanks Doc!
October 5, 2011 at 4:49 am #88526vnvillarParticipantHi Doc,
It didn’t worked :|
October 5, 2011 at 12:46 pm #88555TheDocMemberOkay, mucho frustration!
Let’s try simplifying the loop and getting rid of the ‘else’ stuff and we’ll add a reset:
$args = array(
'posts_per_page' => 3,
'paged' => get_query_var('paged')
);
// The Query
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post(); ?>
">
posts_nav_link();
// Reset Query
wp_reset_query();
?>October 5, 2011 at 2:05 pm #88557vnvillarParticipantHehe true, what would I do without CSS Tricks! :)
Got it, will try again with the code you gave me.
Thanks Doc!
Val
October 6, 2011 at 1:12 am #88588vnvillarParticipantWoohoo! Finally got it working, apparently I also have a main loop at the top part of my homepage I forgot to add on that loop. Thanks so much Doc for the help, really appreciate it!
Thank you CSS Tricks! :D
Best,
Val
October 6, 2011 at 2:23 am #88590TheDocMemberBut of course – should’ve asked about another loop! Glad you got it sorted.
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.