- This topic has 12 replies, 4 voices, and was last updated 2 years, 9 months ago by
sg.
-
AuthorPosts
-
August 21, 2015 at 8:54 am #131121
stefan.zwahlen
Hello folks
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 π
Thanks!
Stefan
August 21, 2015 at 8:59 am #131124Tom
Lead DeveloperLead DeveloperHi Stefan,
You can try a function like this: https://gist.github.com/generatepress/050648ac7d2d566865ac
Not 100% sure it will work, but worth a try π
Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 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 you
November 25, 2015 at 10:34 am #155694Tom
Lead DeveloperLead DeveloperAwesome! You’re welcome π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 15, 2018 at 10:18 am #576335sg
Hi Tom,
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.
thanks
May 15, 2018 at 8:48 pm #576684Tom
Lead DeveloperLead DeveloperHi there,
I’m not sure I understand. Are you only wanting the count to show in the sub-menus?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 15, 2018 at 9:40 pm #576701sg
Hi tom yes. thanks.
May 16, 2018 at 8:50 am #577207Tom
Lead DeveloperLead DeveloperCan you link me to your site?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 16, 2018 at 10:34 am #577338sg
hi tom, i think its here , https://generatepress.com/forums/topic/category-tag-color/
thanks.
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 #577635Tom
Lead DeveloperLead DeveloperDid you remove the code for now? I’m not seeing any counts.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 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 #578120Tom
Lead DeveloperLead DeveloperWhat about it is crashing? Are you getting a specific error?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 17, 2018 at 8:55 am #578122sg
yes. ill update on this soon as it doesnt affct the site at the moment. thanks tom. !
-
AuthorPosts
- You must be logged in to reply to this topic.