Upgraded to 9.1 and my navigation is misbehaving
-
Hello:
I upgraded to 9.1 and now I’ve got a problem with the navigation related to my theme. I’m running mysql 5, which didn’t change between 8.* and 9.1. My customized theme is based on itheme-1-1. Here are the two problems:
1. When users are logged out and I have all my plugins that worked under WP 8.* activated, none of the subpages show. The header shows, but the page simply stops loading without a php error.
2. After playing with it, I discovered that removing some of the plugins allowed the sub pages to complete their loading, but instead of the submenu showing, it shows the main menu where the submenu should be.
Now, when users are logged in, everything works fine. I attempting to test other navigation code in hopes I can remove the existing code. However, I haven’t found anything in the codex (I’ve tried the suggestions on the Pages/Nav Codex for example) that returns the parents and children of the parent page correctly.
You can see an example here: https://www.ewillys.com/?page_id=3339. See how the submenu looks the same as the parent menu.
Here’s the code for the top level menu and sub menu creation:
========= From Itheme 1-1 which go the code from K2 theme
<div id="nav">-
<li class="page_item <?php if ( is_home() ) { ?>current_page_item<?php } ?>">/" title="Home">Home
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?></div><!-- /nav -->
//// IT'S RIGHT HERE WHERE THE CODE BREAKS WHEN ALL PLUGINS ARE INSTALLED///
<?php /* Menu for subpages of current page (thanks to K2 theme for this code) */
global $notfound;
if (is_page() and ($notfound != '1')) {
$current_page = $post->ID;
while($current_page) {
$page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$current_page = $page_query->post_parent;
}
$parent_id = $page_query->ID;
$parent_title = $page_query->post_title;// if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status != 'attachment'")) {
if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_type != 'attachment'")) {
?><div id="subnav">
-
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li=&child_of='. $parent_id); ?>
</div><!-- /sub nav -->
<?php } } ?>
- The topic ‘Upgraded to 9.1 and my navigation is misbehaving’ is closed to new replies.