spoetnik Posted October 21, 2014 Posted October 21, 2014 I give up. I can't find out why this isn't working: // display sidebar navigation, except on homepage, projects, posts, and partners pages if($page->template->name === 'home'|'project'|'projects'|'posts'|'partners'){ echo "no sidebar"; }else{ echo "sidebar"; } Can someone help?
adrian Posted October 21, 2014 Posted October 21, 2014 You are not using a PW selector. This needs to be in PHP syntax: if($page->template->name == 'home'|| $page->template->name == 'project' || $page->template->name == 'projects' || $page->template->name == 'posts' || $page->template->name == 'partners'){ But maybe instead you could see if the $page->sidebar actually exists. Maybe that won't work in your scenario, but thought I should mention it just in case. 1 2
gebeer Posted October 21, 2014 Posted October 21, 2014 try $hassidebar = array('home','project','projects','posts','partners'); if (in_array($page->template->name, $hassidebar) { //... } EDIT: adrian was quicker. Either of it should work. 5
adrian Posted October 21, 2014 Posted October 21, 2014 EDIT: adrian was quicker. Either of it should work. Yeah, but your option is way nicer once you get to more than a couple of options like this 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now