Title: Templates and PHP Includes
Last modified: August 18, 2016

---

# Templates and PHP Includes

 *  [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * (@lexmedia)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/)
 * Seeing as you guys helped me out so much with my permalinks and the ‘if_single’
   tag, I thougt someone must know how to do this:
    Currently I have two includes…
   a main include which is my index page, and a single include which is my single
   article template. The problem is, when I try to browse by catagory, it returns
   me to my main page including all the stuff I don’t want to be there. Anyone know
   what I’m talking about? Visit my site: [http://lexmedia.dnsalias.com/](http://lexmedia.dnsalias.com/)
   for more info. Click the article, then click the link which should take you to
   the general articles catagory. You’ll see what I mean.

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

 *  [Mark Jaquith](https://wordpress.org/support/users/markjaquith/)
 * (@markjaquith)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-99928)
 * the `is_single()` function returns TRUE for single pages… individual archives.
   The category archives return FALSE, just like the main page. If you only want
   stuff showing on the main page, (and you’re using wp 1.3, as I assume you are
   if you are using is_single()) you can use `is_home()` to test if it is the main
   page.
 *  Thread Starter [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * (@lexmedia)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-99973)
 * I’m actually only using version 1.2… Ok, so what you’re saying is I can have 
   is_single go to a single post template, is_home to go to the home page, or else
   to go to all other catagory pages, etc?
 *  Thread Starter [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * (@lexmedia)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-99977)
 * Here’s what I have so far…
    <div id=”wrapper”> <?php include(“heading.php”); ?
   > <?php ##I WANT SINGLE ARTICLES HERE if ($single) { include(“single.php”); }##
   I WANT THE HOME PAGE HERE { include(“main.php”); }##I WANT ALL OTHER BLOG-RELATED
   PAGES HERE## else{ include(“articles.php”); } ?> </div>
 *  Thread Starter [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * (@lexmedia)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-99978)
 * This DOES NOT WORK. Could anyone revise this code to work? Thanks a lot. For 
   reference:
    [http://lexmedia.dnsalias.com/](http://lexmedia.dnsalias.com/)
 *  Thread Starter [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * (@lexmedia)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-100047)
 * Bump

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

The topic ‘Templates and PHP Includes’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [lexmedia](https://wordpress.org/support/users/lexmedia/)
 * Last activity: [21 years, 8 months ago](https://wordpress.org/support/topic/templates-and-php-includes/#post-100047)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
