Jump to content

Bootstrap Nav with unpublished Children


billyudi
 Share

Recommended Posts

So I'm implementing this...

http://wiki.processwire.com/index.php/Bootstrap_Navbar#The_Menu

And is works great, however we are about to launch and, well, the content isn't all ready so we have some children pages unpublished. The problem is that even if all the children pages are set to unpublish the parent page still detects there are children and puts in an empty dropdown menu. 

I'm new to this, so forgive my ignorance. Anyone have any ideas on how to get rid of the dropdown when all children are unpublished?

Link to comment
Share on other sites

Ah now that's the numChildren problem. In that it isn't published or access aware. Means even if all children are unpublished it will return true.

There's now a attribute to make it recognize that 

Not sure what version it was added exactly but maybe this works for you:

change all

$child->numChildren

to 

$child->numChildren(true)

Or if you use older version you can instead replace it with this:

count($child->children)
  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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