Im trying to set up an if statement to display certain code, if the user is on a certain page. I’ve got the links and student work pages to work, but when I add the if not link and not student work I get an unexpected T_BOOLEAN_AND error. How can I fix this so I can list the pages I don’t want custom code for and use just page.php

<?php 
            if (!is_page('links')) && (!is_page('student-work'))  {
                include(TEMPLATEPATH . '/pages/page.php');
            } elseif (is_page('links')) {
                query_posts('cat=2');
                include(TEMPLATEPATH . '/pages/links.php');
            } elseif (is_page('student-work')) {
                query_posts('cat=4');
                include(TEMPLATEPATH . '/pages/student-work.php');
            }
?>

2 Answers
2

I just used this code and it works for me. Hopefully it solves your problem.

if( ! is_page( array( 'links', 'student-work' ) ) ) { /* ... */ }

Leave a Reply

Your email address will not be published. Required fields are marked *