ThemeShaper Forums » Thematic

[closed]

Styling Related links in sidebars (3-column theme)

(4 posts)
  • Started 9 years ago by androidmarv
  • Latest reply from androidmarv
  • This topic is resolved

Tags:

  1. I'm creating a 3-column child-theme of thematic, where the Parent Pages are on the secondary sidebar and the related child-pages show in the primary sidebar (when the parent page is clicked).

    Now the Problem - I want to keep the parent page 'selected' while I'm browsing the child-pages. I can't figure how to maintain '.current_page_item a' selector for the parent while browsing the children.

    In my child-theme functions.php:

    The code for generating parent links:
    <div id="secondary" class="aside main-aside thesecondary">
    <ul class="xoxo">

      <?php
      $output = wp_list_pages('echo=0&depth=1&title_li=' );
      echo $output;
      ?>

    </div>

    The code for generating child links:
    <div id="primary" class="aside main-aside theprimary">
    <ul class="xoxo">

      <?php
      $children=wp_list_pages( 'echo=0&child_of=' . is_subpage() . '&title_li=' );
      echo $children;
      ?>
      </div>

      Where is_subpage() is the function to return parentID.

    Posted 9 years ago #
  2. depending on the depth you are at the parent will either have a class of .current_page_parent or .current_page_ancestor . Style those classes as well.

    Posted 9 years ago #
  3. Jamie Mitchell
    Member

    if you wait for wordpress 3.0, it has the new menu feature that will allow you to add your pages to any sidebar with a widget, and it also has a current_page_item class for styling.

    j

    Posted 9 years ago #
  4. Thanks helga (the viking!!!) and Jamie! I did not notice the .current_page_parent or .current_page_ancestor classes before... so now they are all styled :) Good to know that this will become more obvious with WP3.0

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.