Hi Matt,
Hope all is well with you.
I am trying to get Categories Pro to only show one category at a time, as in when you open a category, any previous category is closed. I tried:
add_action( ‘wp_print_footer_scripts’, function () {
?>
<script>
( function( $ ) {
setTimeout( function() {
$( ‘.child-sidebar-menu > .has_children’ ).click( ‘> span’, function() {
var parent = $( this );
$( ‘.child-sidebar-menu > .has_children.open’ ).each( function() {
if ( parent.text() !== $( this ).text() ) {
asm_pro.accordion._expand_sub_menu( $( this ), $( this ).find( ‘> span’ ) );
}
} );
} );
}, 1000 );
} )( jQuery );
</script>
<?php
} );
in the functions file but it did not seem to work. This was code you gave to someone a while back so thought I would try it. Perhaps there is already functionality for this in the later versions but I could not find it.
Dave
OnPoint Plugins
Hi Dave,
The JavaScript required to make this work will depend on which level of menu items you are trying to close when another is opened.
For instance, you are showing the top level items and would like that level close an open item when another is opened, you may add the following custom JavaScript to your site.
If you would like the first level children to function in this way, the following JavaScript will enable the functionality.
You may add both if you want both both levels to have the functionality.
If you have any issues, it will help to have a link to your site so we can see what you’re targeting.
Have a great night!