Title: Adding code only to post pages
Last modified: August 21, 2016

---

# Adding code only to post pages

 *  [delta223](https://wordpress.org/support/users/delta223/)
 * (@delta223)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-only-to-post-pages/)
 * Hi, I am trying to add a tagging code to post pages only (post category pages
   should also be excluded). The code must go towards the top of the header section.
   How can I do this? My blog is at [http://buildstartups.com/blog/](http://buildstartups.com/blog/)

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-only-to-post-pages/#post-4594493)
 * consider to use a conditional statement based on one of the conditional tags;
 * [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * [http://codex.wordpress.org/Conditional_Tags#The_Main_Page](http://codex.wordpress.org/Conditional_Tags#The_Main_Page)
 *  Thread Starter [delta223](https://wordpress.org/support/users/delta223/)
 * (@delta223)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-only-to-post-pages/#post-4594508)
 * Thank you! I take it I need to use this one:
 * is_single()
 * and I just add this to the index.php file in the header section then?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/adding-code-only-to-post-pages/#post-4594546)
 * what exactly you need to use depends on where exactly you want to include your
   code;
 * this example would **_not _**show the code in single posts:
 *     ```
       <?php if( !is_single() ) :
       /*code*/;
       endif; ?>
       ```
   
 * this example would show the code **_only _**on the posts page:
 *     ```
       <?php if( is_home() ) :
       /*code*/;
       endif; ?>
       ```
   

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

The topic ‘Adding code only to post pages’ is closed to new replies.

## Tags

 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [tagging](https://wordpress.org/support/topic-tag/tagging/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/adding-code-only-to-post-pages/#post-4594546)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
