Title: Conditional Tags
Last modified: August 19, 2016

---

# Conditional Tags

 *  [Erik](https://wordpress.org/support/users/buckycat7/)
 * (@buckycat7)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/conditional-tags-2-2/)
 * I have a site set up with a couple different categories, on being a category 
   for press releases and the other for blog posts. Well I’m running in a bit of
   a problem in the single.php page.
 * I want visitors to be able to post comments on the blog post but not on the press
   releases and there is other meta data that needs to show when someone is viewing
   a blog post or a press release “post.”
 * I figured the best way to do this was using the Conditional tags but this is 
   where I’m running into my trouble. Here is the code I’m trying to work with for
   the meta data change:
 *     ```
       <?php
       	if (is_category(blog)){
           	echo=<p class="meta"><?php the_date(); ?>
       ;
           } else {
           		//Do nothing;
           }
           ?>
       ```
   
 * 1st off this code doesn’t work, so what did I mess up? And is this the easiest
   way to go about something like this or should I be doing it other way?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/conditional-tags-2-2/#post-775585)
 * first off i think you want in_category rather than is_category
 * From [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * > is_category(‘Stinky Cheeses’)
   >  When the archive page for the Category with 
   > Name “Stinky Cheeses” is being displayed.
   > in_category(‘5’)
   >  Returns true if the current post is in the specified category
   > id
 * And you are not talking about archive pages, but a single post in a category.
 * [http://codex.wordpress.org/Template_Tags/in_category](http://codex.wordpress.org/Template_Tags/in_category)
   has more
 *  [morganfardo](https://wordpress.org/support/users/morganfardo/)
 * (@morganfardo)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/conditional-tags-2-2/#post-775851)
 * Hi Buckycat7!
 * Did you find a solution for different meta to different categoryes?
 * Im trying this as well, but without sucess.
 * Thanks,
 * morganfardo
 *  [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * (@rogertheriault)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/conditional-tags-2-2/#post-775852)
 * You can use a category template instead, if you don’t mind managing two templates.
   Usually the way to go if your pages are going to have more than just a few minor
   changes.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Conditional Tags’ is closed to new replies.

 * 3 replies
 * 4 participants
 * Last reply from: [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * Last activity: [17 years, 10 months ago](https://wordpress.org/support/topic/conditional-tags-2-2/#post-775852)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
