Jump to content

Recommended Posts

Posted

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?

Posted

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.

  • Like 1
  • Thanks 2
Posted

try

$hassidebar = array('home','project','projects','posts','partners');
if (in_array($page->template->name, $hassidebar) {
//...
}

EDIT: adrian was quicker. Either of it should work.

  • Like 5
Posted
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 :)

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...