WordPress.org

Ready to get started?Download WordPress

Forums

JQuery Accordion Menu Widget
open the parent div if the page/post is active (2 posts)

  1. squizeers
    Member
    Posted 2 years ago #

    I am working on a portfolio where i have many posts under different categories. I have top navigation as custom menu and have given url to specific post. For example in the site: http://173.193.111.30/project/cutetastrophe/?p=42
    ARTWORK has custom url to the post
    2008
    -summer
    --forever is a long time

    I want to be able to make sure that the 2008 is open when the I click on artwork. Also I hope the same rule applies when i click on next and previous button on the right(which is post navigation), I would like to see the accordion open and close when the respective page is on view.

    So far what I have is:
    in function.php

    if ( ! function_exists( 'post_is_in_descendant_category' ) ) {
          function post_is_in_descendant_category( $cats, $_post = null ) {
              foreach ( (array) $cats as $cat ) {
                  // get_term_children() accepts integer ID only
                  $descendants = get_term_children( (int) $cat, 'category' );
                  if ( $descendants && in_category( $descendants, $_post ) )
                      return true;
              }
              return false;
          }
      }

    and then I am thinking f doing something like following but of course its not working.

    if (in_the_category|| post_is_in_descendant_category()){
    $('li.'+defaults.classExpand+' > a').addClass(defaults.classActive);
    }

    Please someone kindly help.
    Thank you.

    http://wordpress.org/extend/plugins/jquery-vertical-accordion-menu/

  2. mintfactory
    Member
    Posted 2 years ago #

    I'm after the same thing.

    I need some subsections to be open by default on certain pages/posts only. I would greatly appreciate if someone could help on "how to"

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic