Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 95984

lberelson on "jQuery Accordion using categories and child cat titles"

$
0
0

Have read extensively how to use a jQuery accordion in a custom theme I'm attempting. The accordion I'm trying to make would be all categories (and child cats) of id '4' or name 'programs' Here's what I have so far but not working. Function doesn't seem to be used and is not nesting the cats either; even in the hardcoded attempt (see template below). Thx for any help you can offer.
ref: http://howlingwolfmedia.com/site3/class-categories/

functions file:
http://pastebin.com/naZTzHDt

if(!is_admin()){
        wp_deregister_script('jquery');
        wp_register_script('jquery', ('https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'), false, '1.6.4');
        wp_enqueue_script('jquery');
        wp_deregister_script('jquery-ui');
        wp_register_script('jquery-ui', ('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'), false, '1.8.16');
        wp_enqueue_script('jquery-ui');
    }

document read file:
http://pastebin.com/gPRNtbLg

jQuery(document).ready(function($){
            $('#accordion').accordion();
    });

header calls to jQuery
http://pastebin.com/b9W9ak32

<!-- Add the link to the jQuery UI stylesheet 'before' the site CSS file so you can override properties as needed -->
    <link rel="stylesheet" type="text/css" media="screen" href="<?php echo get_stylesheet_directory_uri(); ?>/css/ui.theme.css/" />

    <!-- add js file that invokes the jQuery UI accordion file here
    source: http://www.ethangardner.com/articles/add-a-jquery-ui-accordion-widget-area-to-a-wordpress-theme/  -->
    <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/ux.js"></script>

    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

template using accordion function
http://pastebin.com/i7kawD4j

<div class="accordion"><!-- attempt hard code first -->
    <h3><a href="#">First header</a></h3>
            <div>Content 1 default as collapsed</div>
    <h3><a href="#">Second header</a></h3>
            <div>Content 2 default as collapsed</div>
    </div>

    <!-- accordion dynamic -->
    <div class="accordion">
    <?php
    $args=array(
      'orderby' => 'name',
      'order' => 'ASC',
      'hide_empty' => FALSE, //important or will not display at all since some cats may have no posts
      'child_of' => 4,
      'display' => 'linear'
      );
    $categories=get_categories($args);
      foreach($categories as $category) {
        echo ' <a href="#">' . $category->name.'</a>';
      }
    ?>
    </div>

Viewing all articles
Browse latest Browse all 95984

Trending Articles