• I have successfully got a local version of jquery accordion working ref: http://howlingwolfmedia.com/site3/classes/class-categories/

    2 questions

    1. how to properly use wp_enqueue_script. Currently hardcoded header to local copy of jquery in my theme themename/jquery_ui/js/jquery-ui-1.10.3.custom.js, js/jquery-1.9.1.js and css/ui-lightness/jquery-ui-1.10.3.custom.css respectfully. I’m currently doing this in a multisite installation. And i see there is a min version of accordion in the 3.4.2 install /wp-includes/js/jquery/ui.
    2. How do i get the accordion to expand to content only vs. deepest content e.g. aerobic (with most titles for that cat) vs. nutrition

    And here’s the code used on the template:

    <div id="accordion" style="width:95%;">
    <?php
        $args=array(
          'child_of' => 4,
          'orderby' => 'name',
          'order' => 'ASC',
          'hide_empty' => '0'
          );
        $categories=get_categories($args);
          foreach($categories as $category) {
            echo '<h3>' . $category->name . '</h3>
    		<div>';
    			global $post;
    			$args = array( 'posts_per_page' => -1, 'category' => $category->term_id, 'orderby' => 'name', 'order' => 'ASC' );
    			//alternatively this also works:  'nopaging' => true
    			$myposts = get_posts( $args );
    			foreach( $myposts as $post ) :  setup_postdata($post);
    			echo  '<p><a href="' . get_permalink($post->ID) . ' " style="color:#7c7c7c; font-size: 1em; text-decoration:none !important; line-height:80%;">' . get_the_title($post->ID) . '</a></p>';
    			endforeach;
    		echo  '</div>
           ';
        }
    ?>
    </div><
Viewing 1 replies (of 1 total)
  • Thread Starter lberelson

    (@lberelson)

    #2 resolved: I was instructed that if i add to stylesheet, the active content will auto expand to length of contents per loop.
    .ui-accordion-content-active { height: auto !important; }

Viewing 1 replies (of 1 total)
  • The topic ‘JQuery Accordion auto height not working and properly using wp_enqueue’ is closed to new replies.