Title: Conditional statement to exclude certain text from index.php
Last modified: August 18, 2016

---

# Conditional statement to exclude certain text from index.php

 *  Resolved [med](https://wordpress.org/support/users/med/)
 * (@med)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/conditional-statement-to-exclude-certain-text-from-indexphp/)
 * Hi,
 * I have put some static text on my homepage that appears before the loop actually
   starts.
 * However, when I want to display posts from a certain month or certain category,
   this introductory text is somehow in the way of the reader.
 * I’ve already searched this forum and found a nice solution.
 * I’ve used the following code before the introduction
    `<php if (!$monthnum ||!
   $cat) { ?>` `Text` `<?php } ?>`
 * However, it doesn’t seem to work. If I have only one statement (say, !$cat only),
   everything works fine. It seems that the conditional statement is wrong, although
   I don’t really see why. It’s valid PHP, isn’t it?
 * Anyone’s got an idea how I can solve this? It should work the way I used it, 
   but it’s not. Any ideas appreciated.
 * Thanks,
    T.

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

 *  [TechGnome](https://wordpress.org/support/users/techgnome/)
 * (@techgnome)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/conditional-statement-to-exclude-certain-text-from-indexphp/#post-261261)
 * Try this:
 * `<?php if (is_home()) { ?>
    Put your HTML static text here <?php } ?> Now start
   your loop
 * -tg
 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/conditional-statement-to-exclude-certain-text-from-indexphp/#post-261264)
 * See also: [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [med](https://wordpress.org/support/users/med/)
 * (@med)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/conditional-statement-to-exclude-certain-text-from-indexphp/#post-261356)
 * Thanks a million! It works!
 * I assume the code I used is somewhat outdated. Thanks to Viper for the link. 
   I had a look at the codex, but couldn’t find what I was looking for.
 * Thanks,
 * T.

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

The topic ‘Conditional statement to exclude certain text from index.php’ is closed
to new replies.

## Tags

 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [index](https://wordpress.org/support/topic-tag/index/)
 * [month](https://wordpress.org/support/topic-tag/month/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [med](https://wordpress.org/support/users/med/)
 * Last activity: [20 years, 9 months ago](https://wordpress.org/support/topic/conditional-statement-to-exclude-certain-text-from-indexphp/#post-261356)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
