Support

Account

Home Forums General Issues Relationship Field Posts Per Page

Unread

Relationship Field Posts Per Page

  • Hi there, How can I do to limit posts_per_page on relationship fields? That’s my code:

    <aside id="related-post">
    	<?php 
    	$posts = get_field('correla_blog_post');
    	if( $posts ): ?>
    	    <div class="posts-list clearfix">
    	    <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
    	        <?php setup_postdata($post); ?>
    	        <article class="post-item">
    	        	<figure><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('t300x200'); ?></a></figure>
    	            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	            <div class="entry-excerpt"><p><?php the_field('riassunto_per_anteprima'); ?></p></div>
    	        </article>
    	    <?php endforeach; ?>
    	    </div>
    	    <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    	<?php endif; ?>
    </aside>

    Then… I saw in the old support forum that one guys asked how to paginate these results. @elliot gives him some links but not the code. Has someone else written that? Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.