Hi paulwalker,
I posted a solution to @ysan’s related question that may work for you.
To do something similar with Categories instead of Tags, you’ll want to use the has_category()
function instead of the has_tag
function.
This changes our if
-statement to look like the following. Add this to the top of the template….
<?php if ( has_category('Category1') && has_category('Category2') ) { ?>
… and close with the curly bracket at the bottom of the template….
<?php } //if has Category1 & Category2 ?>
Here’s the full updated template:
<!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
directory so your changes won't be overwritten when the plugin is upgraded. -->
<?php if ( has_category('Category1') && has_category('Category2') ) { ?>
<!-- Start of Post Wrap -->
<div class="post hentry ivycat-post">
<!-- This is the output of the post TITLE -->
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<!-- This is the output of the EXCERPT -->
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
<!-- This is the output of the META information -->
<div class="entry-utility">
<?php if ( count( get_the_category() ) ) : ?>
<span class="cat-links">
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
</span>
<span class="meta-sep">|</span>
<?php endif; ?>
<?php
$tags_list = get_the_tag_list( '', ', ' );
if ( $tags_list ):
?>
<span class="tag-links">
<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
</span>
<span class="meta-sep">|</span>
<?php endif; ?>
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</div>
</div>
<!-- // End of Post Wrap -->
<?php } //if has Category1 & Category2 ?>
Let me know if that helps at all! ??