- This topic has 12 replies, 4 voices, and was last updated 2 years, 5 months ago by sg.
August 21, 2015 at 8:54 am #131121stefan.zwahlen
I’m struggling a bit with the main menu! My menu contains some categories like “News” and I’d like to show the number of posts within such categories directly in the menu. Let’s say the category “News” contains 8 posts, the menu should show “News (8)”.
I tried different solutions including a custom walker for WP_NAV_MENU but the the mobile version of Generatepress did not work properly with this modification.
Is there a easy way to modify some source code?
Any hints or sample codes very appreciated 🙂
StefanAugust 21, 2015 at 8:59 am #131124TomLead DeveloperLead Developer
You can try a function like this: https://gist.github.com/generatepress/050648ac7d2d566865ac
Not 100% sure it will work, but worth a try 🙂November 25, 2015 at 6:34 am #155649Larry
Wow! That worked great.
I tried adding the code through GP Hooks but it didn’t work, so I added it to functions.php in my child theme.
Thank youNovember 25, 2015 at 10:34 am #155694TomLead DeveloperLead DeveloperMay 15, 2018 at 10:18 am #576335sg
the code works great however im trying to hide the counter in the main level menu . how do i achieve this pls. css dont work as the menu class is related to the below menus.
thanksMay 15, 2018 at 8:48 pm #576684TomLead DeveloperLead DeveloperMay 15, 2018 at 9:40 pm #576701sg
Hi tom yes. thanks.May 16, 2018 at 8:50 am #577207TomLead DeveloperLead DeveloperMay 16, 2018 at 10:34 am #577338sg
hi tom, i think its here , https://generatepress.com/forums/topic/category-tag-color/
anyway , the snippet code seems to be crashing with toolset plugins, i need to check with them on this.May 16, 2018 at 8:57 pm #577635TomLead DeveloperLead DeveloperMay 17, 2018 at 7:49 am #578052sg
yes, pls look at my above reply part
the snippet code seems to be crashing with toolset plugins, i need to check with them on this.May 17, 2018 at 8:54 am #578120TomLead DeveloperLead DeveloperMay 17, 2018 at 8:55 am #578122sg
yes. ill update on this soon as it doesnt affct the site at the moment. thanks tom. !
- You must be logged in to reply to this topic.