Can I insert php code into my menu??
-
I’m trying to find a way of adding a piece of php code into my menu.
I’m trying to use this code:
<?php echo get_category_by_slug('news')->category_count; ?>
to add a number-of-posts-in-category count to my menu. The idea is that the categories in my menu (eg. NEWS) will show the number of posts in that category ie “NEWS (76)”.
I’ve tried adding the above code into the custom menu navigation label, but it just displays the code in raw form in the menu.
Is there any way to achieve what I am trying to do???
Thanks very much!!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Can I insert php code into my menu??’ is closed to new replies.