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 know this is a dumb question, but for the love of my life, I can't get the code to work. I have three page templates: home, page and another page-by category. I have a slider that I want to excluded from the default page.php file but to show everywhere else. I have tried to do this with is_page_template , but that isn't working. any help will be much appreciated. I'm not sure if you need my header code. If you do then leave a comment please and I'll paste in in pastebin. Thanks a lot in advance.

share|improve this question
    
For future reference: yes, always include relevant code in your question. Please post the code in the question, not in a Pastebin. –  Chip Bennett May 15 '12 at 17:31

1 Answer 1

up vote 2 down vote accepted

Did you consult the is_page_template() Codex entry?

If you want to query for the page.php page template, then you need to pass that filename to is_page_template(); i.e.:

<?php
if ( ! is_page_template( 'page.php' ) ) {
    // The current page template is NOT page.php;
    // do something
}
?>

Sidenote: if you want to query for being a static page AND not a specific page template:

<?php
if ( is_page() && ! is_page_template( 'page.php' ) ) {
    // Current page is a static page AND
    // The current page template is NOT page.php;
    // do something
}
?>
share|improve this answer
    
Thanks chip. the second solution works!!! I did not know to do that! –  Samia Ruponti May 15 '12 at 17:36

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.