Support » Themes and Templates » Limiting Category for Latest Post?

  • Hi, I was wondering if anyone had any tips on the best way to limit the following snippet of code to just a single category? Thanks in advance for any ideas shared.

    <div id="latest_post"> <!-- start latest_post -->
    <h3 class="mast">Todays Report</h3>
    <?php if ( get_post_meta($post->ID, in_category('Reports'), 'latest_home_img', true) ) { ?>
    <div id="latest_post_image">
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/latest/<?php echo get_post_meta($post->ID, "latest_home_img", $single = true); ?>" alt="<?php bloginfo('name'); ?>: Latest post" width="470" height="175" />
    <?php } ?>
    <h3 class="latest_post_title" id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h3>
    <p><?php echo strip_tags(get_the_excerpt(), ''); ?></p>
    <div class="latest_post_meta">
    <span class="latest_read_on">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Continue Reading</span>
    <span class="latest_comments"><?php comments_popup_link('Post a comment', 'One comment', '% comments', '', 'Comments off'); ?></span>
    <?php $cat = get_the_category(); $cat = $cat[0]; ?>
    <span class="latest_category">cat_ID);?>"><?php echo $cat->cat_name; ?></span>
    </div> <!-- end latest_post -->
  • The topic ‘Limiting Category for Latest Post?’ is closed to new replies.