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
OnPoint Plugins
You may accomplish this with a template override.
Create a folder in your active theme called ‘advanced-sidebar-menu’
Copy the page_list.php or category_list.php from the plugins ‘views’ folder into the folder you just created.
Edit the ul elements in these new files.
bombelli
Thanks for your feedback.
And what about that?
How can we disable the Advances Sidebar Menu Box in pages/posts?
OnPoint Plugins
If you add the following code to your active theme’s functions.php file it will remove the box.
remove_action( 'do_meta_boxes', array( Advanced_Sidebar_Menu_Pro__Meta__Title::instance(), 'createMetaBox' ) );
bombelli
Unfortunately this does not help.
The box is still there
Thanks
bombelli
Thanks, I’m talking exactly about this.
I placed the code in a plugin we load for modifications:
remove_action(‘do_meta_boxes’, array(
Advanced_Sidebar_Menu_Pro__Meta__Title::instance(), ‘createMetaBox’
));
But the metabox is still there.
I have another question regarding Menus for categories.
I want to show the categories in the blog archive and single pages, but for some reason they do not appear.
OnPoint Plugins
If you place the code inside a plugin it must be wrapped in an action otherwise it will run too soon and be unable to de-register the action which is not previously registered. It will work like so.
add_action( 'do_meta_boxes', function() {
remove_action( 'do_meta_boxes', array(
Advanced_Sidebar_Menu_Pro__Meta__Title::instance(),
'createMetaBox'
) );
}, 0 );
The plugin requires a category or post to know which categories to display. If you want it to display elsewhere this may be accomplished via a couple of filters.
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;
}
return get_terms( array(
'parent' => 0,
'fields' => 'ids',
'taxonomy' => 'category',
'hide_empty' => true,
) );
}
bombelli
Thanks a lot for your quick feedback!
Got rid of the metabox 🙂
Unfortunately, the filter you provided do not help.
The sidebar menu containing the categories is still not visible.
Any idea?
OnPoint Plugins
Are other widget displaying in this sidebar? Like if you add a “Text” widget does it display?
Another thing worth mentioning, is the categories must have posts assigned to them to show up.
bombelli
Yes, other widgets appear fine.
And the taxonomy categories has some categories with associated posts defined.
OnPoint Plugins
Turns out because your categories are all on the same level you must have the following options checked in the widget to show up:
Display parent category
Display menu when there is only the parent category