Hi all
I've been using ProcessWire for a while and am completely comfortable using it. BUT, for some reason, today I am unable to echo out a page link!
I have a section (About Us), which did have 4 children. Today I have added a 5th child page, but it refuses to be added to the navigation. I've echoed out the count of children and it is coming back as 4, even though there are now 5. The page is published and saves fine. I've deleted it and re-added it, to no avail.
Has anyone else ever had this issue? Any suggestions more than welcome!
Code for generating menu is below.
$navigation = $page->rootParent->navigation;
if(count($navigation) > 0)
{
//echo count($navigation);
foreach($navigation as $p)
{
$children = $p->children;
//echo $p->url;
//echo count($children);
// count children (exclude certain templates)
if(count($children) && $p->is("template!=news-page|team-page|development-land-page|sheep-sales-page|produce-sales-page|grass-keep-page|property-list-page|property-auctions-page"))
{
// accordion header
?>
<a href="#" class="submenu<?php if($page->parents->has($p) || $p === $page) echo '-current'; ?>"><?= $p->title; ?></a>
<?php
// expandable sub-menu
?>
<div class="sub-sub-links <?php if($page->parents->has($p) || $p === $page) echo 'active'; ?>">
<?php
foreach($children as $child)
{
?>
<a href="<?= $child->url; ?>" <?php if($child === $page) echo 'class="sub-sub-links-current"'; ?>><?= $child->title; ?></a>
<?php
}
?>
</div>
<?php
}
else
{
// single page
if ($page->parents->has($p) || $p === $page)
{
$class = 'sub-links-current';
}
else
{
$class = '';
}
?>
<a href="<?= $p->url; ?>" class="<?= $class; ?>"><?= $p->title; ?></a>
<?php
}
}