Is possible to get current-menu-item as a php variable?
I'm listing the category museums via the menu item 'museums we support' so i'd like the get 'museums we support' bit and display it somewhere?
Any help appreciated!
|
|
|
This is possible by filtering
You can now use this new global variable instead of the normal title. Simple example:
Of course, this only works if you display the menu before you display the title. If you need it earlier (maybe in the |
|||||||||||
|
|
I'm not sure I exactly follow. The "Museums We Support" is generated by a Post Title, Page Title, Category Title, etc. (or, if you're using a Custom Navigation Menu, it could be a custom Title). What are you trying to do with this text? Where are you trying to display it? I assume you're trying to display it on the Category Index Page (since you indicate it is If you need additional category information, you can use something like:
Which makes available the following variables:
If you're somewhere other than the Category Index Page, you'll need to pass the $catid to these functions. EDIT: Since you indicated that "Museums We Support" is a custom Menu Title, the easiest approach would be to rename the Category from "Museums" to "Museums We Support" (note: you can leave the slug, Otherwise, you will have to use something like |
|||||||
|
|
|||
|
|