Hello all,
I've been reading over all of the "enqueue" implementation information on the codex, but still can't seem to get a basic accordion working in a sidebar.
I've broken the parts of the implementation into the enqueue, actual script, and html/php that I'm trying to modify below.
Any advice on this issue would be greatly appreciated. I have a feeling I'm missing a step, or something small. Thanks in advance for reviewing.
ENQUEUE FUNCTIONS (to call jQuery from within WordPress)
<?php
if ( !is_admin() ) { // instruction to only load if it is not the admin area
// register your script location, dependencies and version
wp_register_script('dkBlogAccordion',
get_bloginfo('template_directory') . '/scripts/dkBlogAccordion.js',
array('jquery', 'jquery-ui-core'));
// enqueue the script
wp_enqueue_script('dkBlogAccordion');
}
?>
ACTUAL SCRIPT (dkBlogAccordion.js)
jQuery(document).ready(function() {
jQuery("#sidebar-pages").accordion({ header: "h4" }, { collapsible: "true" }, { active: "false" });
});
HTML & PHP IN SIDEBAR.PHP FILE (I'm trying to apply jQuery to)
<div id="sidebar-pages">
<h4><?php _e('Support Pages'); ?></h4>
<ul>
<?php wp_list_pages('sort_column=menu_order&hierarchical=0&include=2,29,84&title_li='); ?>
</ul>
<h4><?php _e('Support Posts'); ?></h4>
<ul>
<?php wp_list_categories('orderby=name&include=32,46&title_li='); ?>
</ul>
</div>