Support » Plugins » help with in_category

  • Resolved raptrex

    (@raptrex)


    so i have this code where i want it that if the post is in category 19, to get the custom field “linkurl”
    and for the rest of the categories, to display the tags
    this is my single.php

    <?php get_header(); ?>
    	<div id="content" class="post">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    			<div id="post-<?php the_ID(); ?>">
    				<h2><?php the_title(); ?></h2>
    					<?php the_content('<p>Read the rest of this entry &raquo;</p>'); ?>
    					<?php if (in_category('19)) { ?>
    					<div class="url">
    					<a href="<?php echo get_post_meta($post->ID, 'URL', TRUE); ?>" title="<?php the_title(); ?>"><?php the_title() ?></a>
    					</div>
    					<?php else { ?>
    					<div class="tags">
    						Tags:<?php the_tags('&nbsp; ',' &middot; ') ?>
    					</div>
    					<?php } ?>
    		<div id="commentsContainer">
    			<?php comments_template(); ?>
    		</div>
    		<?php endwhile; else: ?>
    
    			<h2>Sorry, the post could not be found.</h2>
    
    		<?php endif; ?>
    
    			</div>
    	</div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    however this is not working, im thinking its the in_category tag

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘help with in_category’ is closed to new replies.