0

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?

1 Answer 1

3

You probably want one of the conditional tags.

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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