[resolved] help with in_category (2 posts)

  1. raptrex
    Posted 7 years ago #

    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>
    					<?php else { ?>
    					<div class="tags">
    						Tags:<?php the_tags('&nbsp; ',' &middot; ') ?>
    					<?php } ?>
    		<div id="commentsContainer">
    			<?php comments_template(); ?>
    		<?php endwhile; else: ?>
    			<h2>Sorry, the post could not be found.</h2>
    		<?php endif; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

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

  2. raptrex
    Posted 7 years ago #

    lol nevermind i was missing a } in front of the else

Topic Closed

This topic has been closed to new replies.

About this Topic