ThemeShaper Forums » Thematic

[closed]

post per page not working

(5 posts)
  • Started 8 years ago by AnotherAndrew
  • Latest reply from AnotherAndrew
  • This topic is resolved
  1. AnotherAndrew
    Member

    I have a template page set up where I am trying to add a custom post type. I would like to have more than 1 custom post display. But for some reason I am only getting one to show.

    I don't know if this is a thematic problem or a general wordpress problem.

    Does anyone know?

    <div id="mgd-sidebar-content">
    			<?php $content_block = new WP_Query(array('post_type'=>'content-block',
    			  'posts_per_page'=>5, 'content-position'=>'exhibitions-page'))?>
    			<?php if($content_block->have_posts()): $content_block->the_post(); ?>
    			  <?php the_content();?>
    			<?php endif; ?>
    		</div>
    Posted 8 years ago #
  2. not a thematic issue. but what is:

    'content-position'=>'exhibitions-page'

    that's defo not one of the default query params, so i'm curious as to what it is, as it is probably effecting your query in a new way.

    Posted 8 years ago #
  3. AnotherAndrew
    Member

    That would be a custom taxonomy. It shouldn't matter though. I have used a similar code function and it still doesn't show more than 1 post.

    Posted 8 years ago #
  4. ahhh ok. well now i see that you don't have a while loop, so you only show one post and will never loop through the multiple posts you might find.

    check out the Usage example:
    http://codex.wordpress.org/Class_Reference/WP_Query

    Posted 8 years ago #
  5. AnotherAndrew
    Member

    Helga you are right! Thanks!!

    <div id="mgd-sidebar-content">
    			<?php $content_block = new WP_Query(array('post_type'=>'content-block',
    			  'posts_per_page'=>5, 'content-position'=>'exhibitions-page'))?>
    			<?php while ($content_block->have_posts()): $content_block->the_post(); ?>
    			  <?php the_content();?>
    			<?php endwhile; ?>
    		</div>
    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.