WordPress.org

Support

Support » How-To and Troubleshooting » Display Posts Only In Category x?

Display Posts Only In Category x?

  • I have the following code:

    <?php
    if (is_page()) {
      $posts = get_posts ("showposts=12");
      if ($posts) {
        foreach ($posts as $post):
          setup_postdata($post); ?>
          <div style="border: 2px solid #ebebeb; width: 210px; float: left; margin-right: 25px; margin-bottom: 25px; padding: 5px;">
    <h4 style="font-size: 14px; font-weight: bold; padding-bottom: 10px;"><?php the_title(); ?></h4>
    <div style="float: right; padding-left: 5px;">
    <?php the_post_thumbnail(); ?>
    </div>
    	<span style="font-size: 12px;"><?php the_content(); ?></span>
    	</div>
        <?php endforeach;
      }
    
    }
    ?>

    How can I make the posts display that are only in the category named “Training Summary” (slug “training-summary”)? Any help would be greatly appreciated!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Display Posts Only In Category x?’ is closed to new replies.
Skip to toolbar