Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

have a site w/a static home page and a posts page and then a number of other static pages - i set up a custom header for the home page and then another all other pages like this in the header

<?php
if(is_home()){
include(TEMPLATEPATH.'/header_front.php');}

else {
include(TEMPLATEPATH.'/header_default.php');}

?>

it works perfectly except that the posts page is displaying header_front.php instead of header_default.php

so i guess im asking how i get wordpress to realize that the posts page isnt the home page

share|improve this question
3  
use is_front_page() for static front pages. –  Wyck Mar 27 '11 at 23:20
1  
You're using the wrong conditional. "is_home()" applies to the Blog Posts index, whether displayed on the Front Page or not. As Wyck said, you need to use "is_front_page()" if you want to output something (or not) on the Front Page. –  Chip Bennett Mar 28 '11 at 3:05
    
yeh i tried that already and it displayed header_default.php on both the static home page and the blog - so it did change the header on the blog but it unfortunately changed it on the home page too - v frustrating - thx tho! –  j1mmy Mar 29 '11 at 5:24

2 Answers 2

Instead of using include(TEMPLATEPATH use the built in WordPress API.

The WordPress API accommodates for using different headers.

<?php 
       if (is_front_page() ) {
               get_header( 'front' );

        } else {
               get_header();
       }
?>

Your custom header template should be named header-front.php and your default header should be named header.php

share|improve this answer

ok so i guess there was some code in the template for the home page that i c&ped off some site that was making wordpress think it was the blog page - once i excised that and then did is_front_page() everything was cool - so thx

this is the code if anyone might be at all interested - i was under the impression it was necessary to designate a template - obvs theres a bunch of extra stuff in there tho

<?php
/*
Template Name: blog
*/
$pagenum = $wp_query->query_vars;
$pagenum = $pagenum['paged'];

if (empty($pagenum)) {
$pagenum = 1;
}

query_posts("posts_per_page=10&paged=$pagenum");
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.