Pergunta

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?

Foi útil?

Solução

You probably want one of the conditional tags.

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top