Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Simon Tucker
Simon Tucker
9,113 Points

My pagination works fine on my blog but doesn't show up on custom post types.

I have a pagination function set-up in functions.php I then target the name in my home.php and the pagination displays fine, however the pagination doesn't show up at all on my custom post types. I have followed the same steps for the blog but nothing. Any ideas?? Cheers.

2 Answers

Simon Tucker
Simon Tucker
9,113 Points

Cracked it. my query was different instead of wp_query it was just query. This bit of code also helped display my required custom posts.

<?php $args = array(
    'post_type' => 'bond' 
  );

    $wp_query = new WP_Query( $args );

      $wp_query->query('showposts=2&post_type=bond'.'&paged='.$paged);
?>

<?php wpex_pagination(); ?> /*this code is in my functions.php */
Andi Wilkinson
Andi Wilkinson
26,822 Points

I had a real problem with this when i built my first WordPress site - but i got round it by using archive-$cpt-name.php as the page template & it worked fine. - let me know if you need any further clarification?

Simon Tucker
Simon Tucker
9,113 Points

Hi, I tried but still not working. Do you have an example? I might be coding it wrong.