Support » Plugin: Custom Field Matrix » [Plugin: Custom Field Matrix] Pagination with custom post type

  • Hi — love this plugin, but I can’t seem to find how to be able to set up pages when there are more than ten posts. I have a custom post type, with each post using Custom Field Matrix for the content. It’s working well, but only the latest 10 are showing. I know they are there, but do not know how to get a next page link working. The following is the relevant code, on the custom post type page template.

    <?php query_posts(array('post_type'=>'smile')); ?>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="entry-content">                
    <?php foreach(get_cfm('Smile',$custom_post_type->ID) as $image): ?>
    <div id="ck-smile-wrap">
    <div id="ck-smile-photo"><img src="<?php echo $image->smile_before_image; ?>" width="250" alt="<?php echo $image->smile_before_alt; ?>" /><div class="ck-smile-tag">Before</div><img src="<?php echo $image->smile_after_image; ?>" width="250" alt="<?php echo $image->smile_after_alt; ?>" /><div class="ck-smile-tag">After</div></div><!-- #ck-smile-photo -->
    <div id="ck-smile-text"><h4 class="entry-title"><?php the_title(); ?></h4>
    <?php echo $image->smile_text; ?></div><!-- #ck-smile-text -->
    <div class="ck-cat-link">
    <?php the_terms( $post->ID, 'procedure', 'Procedure: ', ', ', ' ' ); ?>
    </div><!-- #ck-cat-link -->
        <?php endforeach; ?></div><!-- #ck-smile-wrap -->

    Thanks in advance for any ideas.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Messed up the code for this post. Corrected one follows.

    Holy — I messed that up. In case this can actually help someone else, here is the code that gave me control.

    <?php query_posts(array('post_type'=>'smile',
    						'paged' => $paged)); ?>

    and the actual pagination after the loop closes.

    <?php posts_nav_link('','','« Previous Entries') ?>
    <?php posts_nav_link('','Next Entries »','') ?>

    Hope that comes out a bit better. I don’t have a full understanding of exactly why this is working yet. I more or less guessed at a possible solution and was quite surprised when it worked. Do NOT take this as a fully-tested solution from an expert.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Matrix] Pagination with custom post type’ is closed to new replies.