Title: includes and wordpress
Last modified: August 20, 2016

---

# includes and wordpress

 *  [bluedrag](https://wordpress.org/support/users/bluedrag/)
 * (@bluedrag)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/)
 * hello,
 * I’m trying to link certain files in the header in certain situations. Basically
   when your viewing the static front page of my site one file will be included 
   in the header, where in everyother situation a second file will be included instead.
   I understand the concept of how this will work, but the syntax is alittle iffy
   for me.. so the pseudo code would look like..
 * if ($frontpage == 1) {
    include(‘front-page.php’); } else { include(‘not-front.
   php’); }
 * please help me with the syntax, thanks

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

 *  [sdelamorena](https://wordpress.org/support/users/sdelamorena/)
 * (@sdelamorena)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106160)
 * Try with this:
 *     ```
       <?php if (is_front_page()) {
          include ('front-page.php');
       } else {
          include ('not-front.php');
       } ?>
       ```
   
 *  Thread Starter [bluedrag](https://wordpress.org/support/users/bluedrag/)
 * (@bluedrag)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106164)
 * it still doesn’t seem to be working. Here is the exact code I am using, perhaps
   I’m using the TEMPLATE_PATH tag wrong.. Thanks for your help.
 *     ```
       <?php
   
           if (is_front_page()) {
              include ('TEMPLATE_PATH. ../westbury/front-contentheader.php');
           }
   
           else {
              include ('TEMPLATE_PATH. contentheader.php');
           }
   
           ?>
       ```
   
 *  [sdelamorena](https://wordpress.org/support/users/sdelamorena/)
 * (@sdelamorena)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106166)
 * The TEMPLATE_PATH is wrong, must be:
 *     ```
       <?php if (is_front_page()) {
       	include (TEMPLATEPATH . '/westbury/front-contentheader.php');
       } else {
       	include (TEMPLATEPATH . '/contentheader.php');
       } ?>
       ```
   
 *  Thread Starter [bluedrag](https://wordpress.org/support/users/bluedrag/)
 * (@bluedrag)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106186)
 * Ok so I got the header working using the bloginfo(‘template_url’) tag instead
   of the TEMPLATEPATH tag. Now I am trying to do the same in the footer but it 
   doesn’t seem to be working. Not only do I loose my footer when I impliment this
   code but the WP admin bar disapears
 *     ```
       <?php
           if (is_front_page()) {
                   include (bloginfo("template_url") . 'front-contentfooter.php');
           }
   
           else {
                   include (bloginfo("template_url") . 'contentfooter.php');
           }
           ?>
   
           <?php
   
           <!--basic2col_contentfooter();-->
           wp_footer();
   
           ?>
   
           <?php /*Basic2Col WordPress theme by Kristin K. Wangen http://wangenweb.com/ */ ?>
   
           </body>
           </html>
       ```
   
 * any help is appreciated
 *  [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * (@adeptris)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106272)
 * You have not said what is in the two files, but if it is just a different footer
   content then look at [template parts](http://codex.wordpress.org/Function_Reference/get_template_part).
 * Rename the files and move them both to the theme or child themes folder, `footer-
   content.php` and `footer-front.php`
 * Then the code is as easy as:
 *     ```
       <?php if ( is_home() || is_front_page() ) : ?>
           <?php get_template_part('footer','front'); ?>
       <?php else : ?>
           <?php get_template_part('footer','content'); ?>
       <?php endif; ?>
       ```
   
 * Even easier, just take the code above and save this in a **third file** called`
   footer-custom.php`
 * Then just call this in each file where required with a single line:
 *     ```
       <?php get_template_part('footer','custom'); ?>
       ```
   
 * BTW you are missing the folder switch `/` :
    `include ( bloginfo("template_url").'/
   front-contentfooter.php' );`
 * HTH
 * David

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

The topic ‘includes and wordpress’ is closed to new replies.

## Tags

 * [is_front_page](https://wordpress.org/support/topic-tag/is_front_page/)
 * [php include](https://wordpress.org/support/topic-tag/php-include/)

 * 5 replies
 * 3 participants
 * Last reply from: [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/includes-and-wordpress/#post-2106272)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
