customize page subnavigation.
-
I’m trying to come with the simple code to place in my sidebar.php, to tell wordpress to:
If page is “X” than display the subnavigation header “custum nav title”
Else, do your normal routine.should be a simple PHP command but i know almost zero PHP… please help?
i’m including the code from sidebar.php to point out where it’d need to go
<?php /* Menu for subpages of current page */ 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_type != 'attachment'")) { ?> <li class="widget"> <h2><?php echo $parent_title; ?> <?php _e('Options'); ?></h2> <ul class="list-page"> <?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?> </ul> </li> <?php } } ?>
Viewing 1 replies (of 1 total)
-
This may help:
Viewing 1 replies (of 1 total)
The topic ‘customize page subnavigation.’ is closed to new replies.