Pardon me for being dense, but I’m lost…
I understand the loop, it’s the same for basically every piece of blog software out there. Where I’m lost is in creating the Template Tag. Anytime I try and use the <?php if ( !(in_category(‘3’)) ) { ?> it errors out.
I’m using the exact code on the site just replacing the category number with the one I want to exclude:
<?php get_header(); ?>
<div id=”content” class=”narrowcolumn”>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!– The following tests if the current post is in category 3. –>
<!– If it is not, the code within The Loop is executed as normal. –>
<!– If it is, nothing is done until the next post is processed. –>
<?php if ( !(in_category(’36’)) ) { ?>
<div class=”post”>
<h2>“><?php the_title(); ?></h2>
<small><?php the_time(‘F jS, Y’); ?></small>
<div class=”entry”>
<?php the_content(); ?>
</div>
<p class=”postmetadata”>Posted in <?php the_category(‘, ‘); ?>
</div> <!– closes the first div box –>
<?php } ?> <!– Close the if statement. –>
<?php endwhile; else: ?>
Sorry, no posts matched your criteria.
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
In a new page entry and instead of working like I would assume or even just displaying all categories it’s listing the php code. Am I missing something?
https://nuglops.com/blog/?page_id=1046