• liipotti

    (@liipotti)


    I am in trouble with my design. I had an idea, where the few main navigation elements would be on the header as tabs. When clicking on those, a submenu would open on the sidebar. Is that possible with WP? I′ve tried many different approaches, but none seem to work. I′m using a modified version of a theme called Gazeb by Blogcut.

    The site is https://www.rsyke.net (which is a mess).

    Please help, I promised to have this site done by now, and I′m so clueless…

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jeremy Clark

    (@jeremyclark13)

    I’ve done something like this with pages and subpages, is that what your meaning. See here and click on the about page and see if that like what you want.

    Thread Starter liipotti

    (@liipotti)

    That′s EXACTLY what I′m after!
    How is it done? Some kind of plugin/code yourself? I would describe myself as a beginner with WP, xhtml and PHP in particular.

    Are those Pages or Posts?

    Would it be too much trouble if I could have a look at the sidebar&header, or wherever you′ve made that work?

    Jeremy Clark

    (@jeremyclark13)

    Those are pages, and subpages.

    You can download the theme from theme.clarktech.no-ip.com. But I can give you the basics of it now.

    In your header navigation I use this to produce the page list using depth=1 will only list the top level pages.
    <?php wp_list_pages('title_li=&depth=1'); ?>

    Then in your sidebar I used this code.

    <?php
    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
    if ($children) { ?>
    <ul>
    <li><h2>Pages Below Current</h2>
    <ul><?php echo $children; ?></ul>
    </li></ul>
    <?php } ?>

    This will produce the little menu showing all the subpages.

    Thread Starter liipotti

    (@liipotti)

    It worked! Almost. I got it to show the submenus, but for some reason they disappear from the sidbar after you click on a submenu-item.

    see
    https://www.rsyke.net

    The sidebar code is now:

    <div id=”sivunavi”>

      <?php /* Widgetized sidebar, if you have the plugin installed. */
      if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

    • <?php include (TEMPLATEPATH . ‘/searchform.php’); ?>
    • <?php if ( is_404() || is_category() || is_day() || is_month() ||
      is_year() || is_search() || is_paged() ) {
      ?>

    • <?php /* If this is a 404 page */ if (is_404()) { ?>
      <?php /* If this is a category archive */ } elseif (is_category()) { ?>
      <p>You are currently browsing the archives for the <?php single_cat_title(”); ?> category.</p>

      <?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
      <p>You are currently browsing the /”><?php echo bloginfo(‘name’); ?> blog archives
      for the day <?php the_time(‘l, F jS, Y’); ?>.</p>

      <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
      <p>You are currently browsing the /”><?php echo bloginfo(‘name’); ?> blog archives
      for <?php the_time(‘F, Y’); ?>.</p>

      <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
      <p>You are currently browsing the /”><?php echo bloginfo(‘name’); ?> blog archives
      for the year <?php the_time(‘Y’); ?>.</p>

      <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
      <p>You have searched the /”><?php echo bloginfo(‘name’); ?> blog archives
      for ‘<?php the_search_query(); ?>’. If you are unable to find anything in these search results, you can try one of these links.</p>

      <?php /* If this is a monthly archive */ } elseif (isset($_GET[‘paged’]) && !empty($_GET[‘paged’])) { ?>
      <p>You are currently browsing the /”><?php echo bloginfo(‘name’); ?> blog archives.</p>

      <?php } ?>

    • <?php }?>

      <?php
      $children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&echo=0′);
      if ($children) { ?>

    • <h2>Alaosiot</h2>
      <?php echo $children; ?>

    <?php } ?>

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>

    • <h2>Yll?pito</h2>
      <?php wp_register(); ?>

    • <?php wp_loginout(); ?>
    • WordPress
    • <?php wp_meta(); ?>

    <?php } ?>

    <?php endif; ?>

    </div>

    Thread Starter liipotti

    (@liipotti)

    Please? Any ideas why the menu on the sidebar changes/disappears after clicking a submenu-item?

    I really have no idea. I′m guessing that it could have something to do with all those IF′s. Tried adding <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> also to the

    <?php
    $children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&echo=0′);
    if ($children) { ?>

    * <h2>Alaosiot</h2>
    <?php echo $children; ?>

    Everything I′ve tried to do to solve this issue have not succeeded. I would be SO thankful for any kind of help.

    Try this code. I pulled it out of the codex.

    <?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 } ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Main navigation to header submenu to sidebar’ is closed to new replies.