display bug for subpages on 404 and search results
-
Not sure if this should be an advanced topic or not… but I’m using the following codex example to display subpage navigation links ONLY on pages that have child pages assigned, or when ON a child page:
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
It works flawlessly except on the 404.php page, and erroneous search results pages (a.k.a any term that produces NO results). Instead, what’s happening is the nav is being listed in its entirety (and in duplicate). You can see what I mean here:
https://cornerstone.designadaptations.com/whateverOddly enough, search terms that do produce results don’t have the same bug, but still show child pages where there should be none. The two templates do nothing more than call the header as any normal page would. Does anyone have ANY CLUE why the code above would not work properly in those two instances? I’m stumped.
p.s. The Basic Page demo is the only one with any child pages assigned.
- The topic ‘display bug for subpages on 404 and search results’ is closed to new replies.