October 5, 2012 at 12:31 am #16830
It drives me crazy how WordPress assigns classes to ancestor pages, current pages, etc… It really would be nice if there was a plugin or mechanism to force classes to be applied.
Anyways, I’m using Propulsion and have woocommerce installed. On the main category page, I’ve styled the proper classes for current-menu-parent classes, etc… And that works fine for menus which are generated that look like this:
<li id=”menu-item-40″ class=”menu-item menu-item-type-post_type menu-item-object-page current-menu-item current_page_item menu-item-40″>Our Products
The classes are being added and so it can be easily styled. However, it would appear that the “Category” listing is not even adding these classes to the HTML object.
So the process of my store is:
Main website –> shop page (which contains categories and has the proper classed) –> Products listing (WHICH DOES NOT ADD THE PROPER CLASSES TO THE HTML) –> Product page (which also works fine and has the classes assigned)
The Category listing looks like this
<li id=”menu-item-40″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-40″>Our Products
There is no current-menu-item current_page_item and cannot be styled. Any thoughts???????October 5, 2012 at 3:43 am #93047
You can add .archive.tax-product_cat, this is the body classes assigned on woocommerce category archive.
IsmaelOctober 5, 2012 at 1:22 pm #93048
What would I add that to? I see that the tax-product_cat class is applied to the body tag as well as the archive class, but how can I use this to style the currently selected navigational element?October 8, 2012 at 7:16 am #93049
Actually it doesn’t help you because the body class affects all menu items. If the menu item itself doesn’t provide an unique class it’s hard to style it in a different way. I’d contact the woocommerce plugin devs and ask them to include a filter function for woocommerce menu items: http://support.woothemes.comOctober 11, 2012 at 2:44 pm #93050
I’ve been back and forth with woocommerce and it’s been determined it’s an issue with the theme. I’ve got twenty eleven installed right now and the class “current_page_parent” is being applied to the product category as expected. http://www.tri-point.com/staging/product-category/durafelx/
When it’s the Propulsion theme, this class is not part of the list as noted above. Any ideas?October 13, 2012 at 7:46 pm #93051
I’m keeping up the Twenty Eleven theme for you to see that the current_page_parent is indeed being added to the category page class. Please let me know of a response as I’m waiting to hear back and solve this issue and can switch back to the propulsion theme.October 15, 2012 at 5:38 pm #93052
I see what you mean in your example with Twenty Eleven. I’ve tagged both Kriesi and Dude on this to get their input on the issue.
DevinOctober 16, 2012 at 6:31 am #93053
I asked Kriesi to look into it and to update the menu walker class.
PeterOctober 16, 2012 at 1:22 pm #93054November 3, 2012 at 3:42 pm #93055
Actually I am not sure what you mean since the link you provided serves a 404 page for me…
Also the theme does use the wordpress default menu walker and should generate the same code as twenty 11
Would you mind setting up the page once again so it doesnt serve a 404 so I can take a look?November 9, 2012 at 2:06 pm #93056
Sorry, didn’t see this until now.
You can see that there is no class applied to the active menu items
But the main category page and the product page does have the current class applied:
TwentyEleven theme applies the classes to all of the pages above.
Thanks!November 11, 2012 at 8:27 am #93057November 19, 2012 at 9:33 pm #93058November 20, 2012 at 8:46 pm #93059
None that I know of. I’ll see if I can get a word from Kriesi on the issue or if he can post here.
DevinNovember 21, 2012 at 1:38 pm #93060November 26, 2012 at 12:10 pm #93061
Since your site is no longer available, I set everything up locally but I am not finding the problem you are describing http://i.imgur.com/OF27C.png .
If you look at the url in the image its structure looks the same as the url you provided above as an example.
The html of the menu item looks like
<li id="menu-item-360" class="menu-item menu-item-type-taxonomy menu-item-object-product_cat current-menu-item menu-item-360"><a href="http://propulsion.wp.dev/product-category/wordpress-themes/">WordPress Themes</a>
NickNovember 28, 2012 at 1:18 am #93062
@Nick – The links are still working (as per a few posts above).
http://www.tri-point.com/product-category/plastic-buckles/tensionlocks-ladderlocks/ does NOT contain the current-menu-item class on the active menu with propulsion as the theme, however, the twenty eleven theme does.November 29, 2012 at 1:05 am #93063
I’m not sure what version of Propulsion you are running but it appears as though this is working correctly now on the demo site which is running version 1.7 of the theme.
The individual items are showing current_page_parent on the Shop page in the menu which can be used to correctly style the parent “shop” in the menu as active.
However, even on the WooCommerce demo, when looking at a product category the Shop link does *not* get any class that would highlight it as a parent or current page item. If this is the behavior you are looking for it doesn’t look like its included into the plugin which we wouldn’t be able to modify directly.
DevinNovember 29, 2012 at 5:34 pm #93064
The demo site at: http://www.kriesi.at/themes/propulsion/product-category/blog-theme/ is not working properly.
There is no current_page_parent class on the menu element on this category page. If you enable the twentyeleven theme, it works as expected.November 29, 2012 at 6:27 pm #93065
I understand that there is not, however the demo themes from WooCommerce do not appear to have this function either which leads me to believe it is either designed this way by the plugin or is a bug within the plugin.
See the tshirt category on the “Definition” theme from WooThemes here: http://demo2.woothemes.com/definition/product-category/tshirts/
DevinNovember 29, 2012 at 8:56 pm #93066
Well I think I’m about to give up. I was told specifically by woothemes after troubleshooting that:
“This isn’t something specific to WooCommerce rather a side-effect of WordPress Menus and/or the theme you’re using.
Active categories _should_ have the “current-menu-item” class applied to them. You can see this if you add a category to your main nav and visit it with the TwentyEleven theme.
I can’t see a category in your sites navigation to check. Could you add one and activate TwentyEleven to see if there’s an issue in your theme.”
I enabled the twentyeleven theme and it worked perfectly fine and all of the page types had the classes applied to navigational elements. Enable Propulsion and voila, it disappears again.December 3, 2012 at 7:00 pm #93067
Seems we have each side pointing to the other :(
If it was happening with a WooThemes theme designed for WooCommerce I’d say its a Propulsion issue but it may in fact be something we are both not seeing.
I’ll tag this for Kriesi again as I believe has contacts with WooThemes and might be able to help bridge the gap on this.
The topic ‘current-menu-parent specific to woocommerce’ is closed to new replies.