WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my single.php file I would like to have a conditional that checks for the category of the post and display certain images and layout. Here is what I have: http://pastebin.com/dy6TE1yr

share|improve this question
up vote 2 down vote accepted

Look at http://codex.wordpress.org/Function_Reference/in_category

Example:

<?php if ( in_category('rabbis-weekly-commentary') ) : ?>                   
<div id="inner_header">
<img src="http://www.ifcj.ca/ifcj_ca/images/elements/commentary_header.gif" border="0">
...
<?php elseif ( in_category('yaels-weekly-commentary') ) : ?>                    
<div id="inner_header">
<img src="http://www.ifcj.ca/ifcj_ca/images/elements/commentary_header.gif" border="0">
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.