Jump to content

Menu order strange error


mrjasongorman
 Share

Recommended Posts

I'm just having some trouble with my main menu, it's started happening all of a sudden across a few of my processwire sites (completely separate).

I'm using MarkupSimpleNavigation to generate the menu. But when i look at the menu the Home (id 1) goes into the second position in the menu rather than the first.

But when i login and check again, it's back to normal.

The tree structure obviously has Home as the root.

<?php $topMenu = $pages->find('id=1|1018|1026|1019|1020|1021|1023, sort=sort'); ?>
					<?php
						$treeMenu = $modules->get('MarkupSimpleNavigation');
						$currentRoot = $page->rootParent();
						echo $treeMenu->render( array('max_levels'=>1, 'parent_class'=>'parent', 'current_class' => 'current'), null, $topMenu );
					?>

This is the code i'm using to generate the menu.

Any help on this would be great.

Thanks

Link to comment
Share on other sites

Actually this did not quite work correctly i instead refactored the code to generate the array.

From this

$topMenu = $pages->find("id=1|1001|1025|1044|1035|1061|1043|1062, sort=sort");

to this:

$root = $pages->get('/');
$topMenu = $root->children('id=1001|1025|1044|1035|1061|1043|1062');
$topMenu = $topMenu->prepend($root);
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

×
×
  • Create New...