Help displaying unique attributes to specific Category in Single.php
-
Hey guys,
First time poster here. Hope somebody can help me out.Im trying to modify my single.php to display (the_time, the_author, the_tags, the_comments) only on one specific category (the category being Blog). All other categories will only display the Title & content. I tried playing with some if statements but must be missing something as it wasnt working at all.
Here is the original single.php
<?php get_header(); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); $preview = get_post_meta($post->ID, 'preview', true); ?> <div id="featured"> <div class="container"> <div class="featured-small clearfix"> <h2 class="featured"><?php the_title(); ?></h2> </div> </div> </div> <div id="content"> <div class="container clearfix"> <div id="left-col"> <ul class="post-list clearfix"> <li class="post-last clearfix"> <div class="meta"> <h3><?php the_category(', ') ?></h3> </div> <div class="post-content"> <?php if ( get_post_meta($post->ID,'image', true) && !get_option('woo_image_disable') ) { ?> <a title="Permanent Link to <?php the_title(); ?>" href="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" rel="lightbox"><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "image", $single = true); ?>&h=<?php if ( get_option('woo_image_height') <> "" ) { echo get_option('woo_image_height'); } else { ?>173<?php } ?>&w=<?php if ( get_option('woo_image_width') <> "" ) { echo get_option('woo_image_width'); } else { ?>230<?php } ?>&zc=1&q=90" alt="<?php the_title(); ?>" class="post-preview left" /></a> <?php } ?> <?php the_content('Continue Reading...'); ?> </div> </li> </ul> </div> <div id="right-col"> <?php get_sidebar(); ?> </div> </div> <?php endwhile; ?> <?php else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <!-- / content --> <?php get_footer(); ?>Heres what I was poking around with… forgive me if Im way off. I hail from NoobTown.
<div class="meta"> <?php if (is_category('Blog')) { ?> <h3><?php the_category(', ') ?></h3> <p>Posted on <?php the_time('F jS, Y') ?></p> <p>Written by <?php the_author(); ?></p> <h4 class="related-posts">Related Posts</h4> <ul class="related_posts"> <?php rp_related_posts(''); ?> </ul> <h4 class="tags">Tags</h4> <?php the_tags( '', ', ', ''); ?> <?php } else { ?> <h3><?php the_category(', ') ?></h3> <?php } ?> </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Help displaying unique attributes to specific Category in Single.php’ is closed to new replies.