Title: PHP help?  Probably easy
Last modified: August 21, 2016

---

# PHP help? Probably easy

 *  Resolved [nickaster](https://wordpress.org/support/users/nickaster/)
 * (@nickaster)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/)
 * Howdy…. I have a special banner that appear on all post pages. It’s hard coded
   into the single.php page. However, I’ve no realized that once in a while I don’t
   want that banner to show. So I want to add some php around it so it doesn’t show
   up if the post is tagged with certain tags, let’s say “apples” and “bananas”.
 * Anyone know the PHP to do this?
 * ie:
 * <if tag does not = apples or bananas >
    show this stuff <end if>
 * Thanks!

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

 *  [Thomas McMahon](https://wordpress.org/support/users/twistermc/)
 * (@twistermc)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931621)
 * You want to use the is_tag function. [http://codex.wordpress.org/Function_Reference/is_tag](http://codex.wordpress.org/Function_Reference/is_tag)
 * if ( !is_tag( array( ‘apple’, ‘banana’ ) ); ) {
    // show banner }
 * That should do it. Not 100% sure that !is_tag will work properly. If not, you’ll
   have to remove the ! and just list all tags the banner should show on.
 * if ( is_tag( array( ‘grape’, ‘orange’ ) ); ) {
    // show banner }
 *  Thread Starter [nickaster](https://wordpress.org/support/users/nickaster/)
 * (@nickaster)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931632)
 * brilliant, thanks. But what’s the exact code including ?php I need to use HTML
   inside it? I’m thinking something like this?
 * <?php if ( !is_tag( array( ‘apple’, ‘banana’ ) ); ) { ?>
 * Bunch of stuff goes here
 * <?php } ?>
 * That seems to nuke my page, so something wrong!
 *  [Thomas McMahon](https://wordpress.org/support/users/twistermc/)
 * (@twistermc)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931635)
 * Oh, there is an extra ; in there that shouldn’t be.
 *     ```
       <?php if ( !is_tag( array( 'apple', 'banana' ) ) ) { ?>
   
       Bunch of stuff goes here
   
       <?php } ?>
       ```
   
 *  Thread Starter [nickaster](https://wordpress.org/support/users/nickaster/)
 * (@nickaster)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931650)
 * ah!
 * Well, no error now, but I’m afraid it didn’t work. I pased it verbatim as above
   and tagged a few posts “apples” and a few “bananas” and a few both and the “Bunch
   of stuff” still shows regardless…
 *  [Thomas McMahon](https://wordpress.org/support/users/twistermc/)
 * (@twistermc)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931655)
 * I was worried that the !is_tag may not work. Try:
 *     ```
       <?php if ( is_tag( array( 'grape', 'orange' ) ) ) { ?>
   
       Bunch of stuff goes here
   
       <?php } ?>
       ```
   
 * I’ll try it too.
 *  [Thomas McMahon](https://wordpress.org/support/users/twistermc/)
 * (@twistermc)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931657)
 * I lead you down the wrong path. Sorry about that. Give me a moment.
 *  [Thomas McMahon](https://wordpress.org/support/users/twistermc/)
 * (@twistermc)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931658)
 * has_tag not is_tag 🙂
 *     ```
       <?php if ( !has_tag( array( 'apple', 'grape' ) ) ) { ?>
         This post is NOT tagged apple or grape.
       <?php } ?>
   
       <?php if ( has_tag( array( 'apple', 'grape' ) ) ) { ?>
         This post IS tagged apple or grape.
       <?php } ?>
       ```
   
 *  Thread Starter [nickaster](https://wordpress.org/support/users/nickaster/)
 * (@nickaster)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931661)
 * Stupendous!
 * We are in business. Thanks a million for your help.

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

The topic ‘PHP help? Probably easy’ is closed to new replies.

 * 8 replies
 * 2 participants
 * Last reply from: [nickaster](https://wordpress.org/support/users/nickaster/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/php-help-probably-easy/#post-3931661)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
