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.

I've got a CMS style setup. The blog part is not on the home page.

I'm trying to add certain things to the side-bar according to which template the page is using.

That all works fine, except for the blog page, which does not even reveal its template name.

echo get_post_meta($post->ID,'_wp_page_template',true);  // produces nothing for blog template blog-page.php, but does show standard-page.php

if ( is_page_template('blog-page.php')) { 
// show blog sidebar stuff.... never gets called
}
if ( is_page_template('standard-page.php')) { 
// show blog sidebar stuff.. this works
}

What else can I use to check if the page is a blog page rather than then template?

UPDATE

Doesn't seem to be actually using blog-page.php, but index.php instead... what if statement can i use to check if its a blog-style page?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You probably want one of the conditional tags.

Possibly is_single(), or maybe get_post_type() == 'post' depending on how complex your setup is.

share|improve this answer
    
Thanks, I used is_home() || is_single() –  cannyboy Sep 10 '10 at 13:40
add comment

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.