We just bought the Advances Sidebar Pro. So far all good, but I have two questions:
– How can we add own classes to the <ul> element of a menu? Filter?
– How can we disable the Advances Sidebar Menu Box in pages/posts?
Thanks
Custom UL classes and disable menu box in pages/posts
Resolved
bombelli
Thanks a lot.
Is there a way to define additionally where to show the menu.
Let’s say on blog and specific archive pages only?
OnPoint Plugins
There are a number of plugins which allow you to show widgets on particular sections. Here are a couple examples (I am in no way affiliated with these other plugins and can not guarantee their functionality):
https://wordpress.org/plugins/restrict-widgets/
https://wordpress.org/plugins/widget-options/
Otherwise if you would like to do this programmatically, you may update the previously sent filters to:
add_filter( 'advanced-sidebar-menu/menus/category/is-displayed', '__return_true' );
add_filter( 'advanced_sidebar_menu_category_ids', 'include_all_parent_terms', 1, 4 );
function include_all_parent_terms( $term_ids, $args, $instance, $object ) {
if ( 'category' !== $object->get_taxonomy() ) {
return $term_ids;
}
//ADD CATEGORIES YOU WANT TO DISPLAY TO THIS ARRAY
$categories = array( 'news' );
if( is_page( 29 ) || is_category( $categories ) ) {
return get_terms( array(
'parent' => 0,
'fields' => 'ids',
'taxonomy' => 'category',
'hide_empty' => true,
) );
}
return array();
}
This will display the widget on your blog page and whatever categories you add to the $categories array, marked with.
//ADD CATEGORIES YOU WANT TO DISPLAY TO THIS ARRAY
bombelli
I have another question.
When I open a single post page from a CPT, then the menu disappears.
I checked the template and the sidebar is included.
Any idea?
OnPoint Plugins
It appears you are using an “Advanced Menu” widget on the page. I am unfamiliar with that widget but I took a quick look anyway. I have confirmed that it is added to that sidebar and the options appear to be correct.
Due to my lack of knowledge of this widget, I am unable to provide a solution. I recommend reaching out to the developer of the widget to see if they have a solution.
bombelli
Sorry!
I confused the widgets!
But thanks for looking into it!