WordPress.org

Ready to get started?Download WordPress

Forums

Oxygen
Create dynamic secondary menu? (3 posts)

  1. coseeflorida
    Member
    Posted 1 year ago #

    I would like to use the secondary menu in Oxygen to have page-specific menus (e.g. they would all be different). It seems that the template is set up to have one static menu that appears on all pages. Would someone be able to point me in the right direction to modify this? My site is locally hosted, so apologies that I can't link to it.
    Thanks!

  2. Griden
    Member
    Theme Author

    Posted 1 year ago #

    Try some plugin like Widget Context: http://wordpress.org/extend/plugins/widget-context/.

  3. ajcke
    Member
    Posted 1 year ago #

    You don't need a plugin. I'm using the following code to accomplish this. This code displays the parent page with the h2 tag and then the children pages are listed in an unordered list.

    <div id="menu-secondary">
    
    <?php
      if($post->post_parent) {
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $titlenamer = get_the_title($post->post_parent);
      }
    
      else {
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      $titlenamer = get_the_title($post->ID);
      }
      if ($children) { ?>
     <h2 class="parent"> <?php echo $titlenamer; ?> </h2> 
    
    <ul>
      <?php echo $children; ?>
      </ul>
    <?php } ?>
    </div>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic