StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-27-2012, 02:06 AM
blogjunkie blogjunkie is offline
Registered User
Genesis Member
Pro Plus Member
 
Join Date: Aug 2011
Location: Malaysia
Posts: 56
Default Pagination with custom post types on a page template

I'm trying to display a list of testimonials on a testimonials page. The testimonials are enabled through the TB Testimonials plugin.

I then created a page template for it with the following code:

PHP Code:
<?php
/* 
Template Name: Testimonials
*/

add_action('genesis_after_loop''testimonials_loop');
 
function 
testimonials_loop() {
    global 
$paged;
    
$paged   get_query_var'paged' ) ? get_query_var'paged' ) : 1;
    
$args = (array(
    
'post_type' => 'testimonial',
    
'paged' => $paged,
    
'posts_per_page' => 4
    
));
    
$loop = new WP_Query$args ); 
    
?>
        <div id="testimonials" class="hentry">
        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <div id="post-<?php the_ID(); ?>" class="testimonial">
            
                <h2><?php the_title(); ?></h2>
                <div class="entry-content">
                    <?php the_content(); ?>
                    <?php echo genesis_get_custom_field('tbtestimonial_company'); ?>
                </div>
            
            </div><!-- /#post-ID -->
        <?php endwhile;?>
        </div><!-- /#testimonials -->
<?php        
}
genesis();
?>
Unfortunately I'm not able to get pagination working. I've double checked that my Reading Settings are only showing 4 per page. I even tried adding <?php genesis_posts_nav(); ?> after the endwhile; statement above with no luck.

Appreciate any help with this.

Here's a link to the site: http://beta.neilsonreeves.co.uk/abou...-testimonials/
 

Tags
custom post type, pagination

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:50 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.