Leave a Reply

54 Comments on "WordPress Pagination Tutorial (Custom Query & Template Integration)"

Notify of
avatar

piyush sharma
Guest
piyush sharma
22 hours 29 minutes ago
hiii i do it all the way you did it but mine doesn't workplz check my code if there is mistake let me know <?php $courrentpage = get_query_var('paged'); global $post; $args = new WP_query( array( 'posts_per_page' => 5 , 'category_name' => 'blog' , 'paged' => $currentpage )); $myposts = get_posts( $args ); ?> <div class="col-md-8"> <?php foreach( $myposts as $post ) : setup_postdata($post); ?> <div><div class=" blogpost" id="site-blog-post"><div class="box"> <div class="content-block"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <div class="dateval"><span><?php echo get_the_date(); ?></span></div> <p><?php the_excerpt(); ?></p> </div> </div> </div></div> <?php endforeach; ?> <?php paginate_links(array( 'total' => $arg->max_num_pages )); ?> </div><!-left section… Read more »
piyush sharma
Guest
piyush sharma
21 hours 57 minutes ago

i found that i have spelling mistake i variable $currentpage but after correcting it still no working

katrin cabalida
Guest
katrin cabalida
1 day 1 hour ago

Hello, I'm a beginner of WP. Thanks for this tutorial. This is very helpful. I get to learn WP theme dev one step at a time, and it's easy to follow. I like it when you give homework, I get to learn on my own. Hope to see more tutorials like this one. BTW, I followed your channel hoping to get more and learn more in easiest ways possible. THANK YOU! God Bless!

Fabio Prandoni
Guest
Fabio Prandoni
1 day 19 hours ago

This is an insanaly good tutorial my friend!

Nathan Gueye
Guest
Nathan Gueye
6 days 22 hours ago

Hi Brad, I love your videos and they have helped me out so much. I just wanted to know if you were planning on making a jquery serie for wordpress?Cheers, and thanks for everything you do.

Aflam 4 All
Guest
Aflam 4 All
8 days 8 hours ago

fuck you that doesn't work for me

Shailesh Thakor
Guest
Shailesh Thakor
10 days 1 hour ago

thanks….

Валентин Сухомудь
Guest
Валентин Сухомудь
12 days 13 hours ago

thank you!Very!!!

Japi Sandhu
Guest
Japi Sandhu
14 days 16 hours ago
It still wont work for me, very frustrated have been attempting to fix this issue for 2 weeks. Please help What am I doing wrong?? <?php $ourCurrentPage = get_query_var('page'); $args = array( 'posts_per_page' => 3, 'page' => $ourCurrentPage ); // Instantiate custom query $custom_query = new WP_Query( $args ); // Output custom query loop if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?> <h3 class="entry-title"><?php the_title(); ?></h3> <p><?php the_content(); ?></p> <?php endwhile; echo paginate_links(array( 'total' => $custom_query->max_num_pages)); endif; ?>
Sylvain Schellenberger
Guest
Sylvain Schellenberger
1 day 20 hours ago

I see you use 'page' both in get_query_var() and your WP_Query, which is the syntax for querying other pages inside a page.

If you want to query posts inside a page, use get_query_var('page') and WP_Query( array( 'paged' => $yourNumber ) );

At least that's what bothered me today.

Manoel Vasconcelos
Guest
Manoel Vasconcelos
1 month 18 days ago

Hi, I've been looking for this information for weeks and now you've helped me.I'm with the happy with project completed.Thank you very much!

Umer Hassan
Guest
Umer Hassan
1 month 22 days ago

Perfect..!!! thank you…

1 2 3 5
wpDiscuz