Is the latest version fully integrated and compatible with the latest WooCommerce?
Any way I can show categories in sidebar on homepage (not shop page)?
We use cookies to allow login, checkout, and analyze site traffic. By continuing to use this website, you consent to the use of cookies in accordance with our cookie policy.
OnPoint Plugins
This will work with product categories out of the box. While technically it could be filtered to work with products, they are not hierarchical which would not make much of a menu.
If you add the following filter to your active theme’s functions.php file this will display all categories on the home page.
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( is_home() || is_front_page() ) {
return get_terms( array(
'parent' => 0,
'fields' => 'ids',
'taxonomy' => $object->get_taxonomy(),
'hide_empty' => true,
) );
}
return array();
}
dave
Cheers
dave
However, this seems to stop display on any other pages and also seems to change the styling somehow?
OnPoint Plugins
If you change the filters to this it will display on the homepage and not change any functionality any where else.
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( is_home() || is_front_page() ) {
return get_terms( array(
'parent' => 0,
'fields' => 'ids',
'taxonomy' => $object->get_taxonomy(),
'hide_empty' => true,
) );
}
return $term_ids;
}
Once you have this displayed on the homepage I can help you adjust your theme styles. Currently they have a margin or something between lists.
dave
OnPoint Plugins
Hi Dave,
While I don’t see the menu on the shop page (I assume you removed it for now). I do see a bunch of JavaScript errors on that page which are not related to this plugin.
The errors appear to be from Storefront Pro, and some signup forms plugin. I also see a reference to a broken jQuery URL.
Until these JavaScript errors are fixed this menu’s accordion functionality will not work.
dave
Humm … thanks for your response. I did not move the menu. It has never showed up on the shop page, although I would like it to. And, I do not see any javascript errors at all on the shop page?
There are no javascript errors in the console so not sure where you are seeing this?
Sorry for all these emails .. but it is late here and I am going to get some sleep. However, just found perhaps a clue. I had the console open and went through all my pages, or at least a bunch of them. No errors. However, while the console was open, the category menu and the price filter worked fine. Close the console and it stopped working again. Perhaps a loading issue and the console maybe delays something long enough to allow everything to load.
OnPoint Plugins
Can you confirm the widget has been added to the same sidebar as the woocommerce price filter widget? Your suggested code is correct to make it show up on the shop page.
It sounds like you may have a browser cache issue preventing things from working. There is an option that allows disabling cache when the console is open which may explain why it only works when open. Does it work if you clear your browser cache?
Here are the errors I see in the console on the shop page but these will not prevent the widget from showing up.
OnPoint Plugins
The ability to display the widget on every page the sidebar is displayed (such as shop page or homepage) is now part the PRO plugin version 3.1.0
For finer control you may still use the above filters or a plugin from the WordPress community which allows specifying pages a widget or sidebar should display. As long as “Display on every page” is checked in the widget, this plugin will honor any location settings from other WordPress plugins.
dave
Humm … those Javascript errors seem to be related to functionality I am not using on the site. And still, after clearing cache I do not see errors. Everything comes back as OK.