WordPress.org

Ready to get started?Download WordPress

Forums

Limiting Category for Latest Post? (1 post)

  1. richardault
    Member
    Posted 6 years ago #

    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" />
    </div>
    
    <?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>
    
    </div> <!-- end latest_post -->

Topic Closed

This topic has been closed to new replies.

About this Topic