Title: customize page subnavigation.
Last modified: August 19, 2016

---

# customize page subnavigation.

 *  [tanmccuin](https://wordpress.org/support/users/tanmccuin/)
 * (@tanmccuin)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/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)

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/customize-page-subnavigation/#post-890242)
 * This may help:
 * [http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page](http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page)

Viewing 1 replies (of 1 total)

The topic ‘customize page subnavigation.’ is closed to new replies.

## Tags

 * [page-navigation](https://wordpress.org/support/topic-tag/page-navigation/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [Subnav](https://wordpress.org/support/topic-tag/subnav/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [iridiax](https://wordpress.org/support/users/iridiax/)
 * Last activity: [17 years, 6 months ago](https://wordpress.org/support/topic/customize-page-subnavigation/#post-890242)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
