Need help writing a plugin to change my navigation menu
-
I need some help writing a plugin to change my main navigation menu
(I’ve done LOTS of reading of the WP docs – but no practical experience yet!)The code I have so far is my plugin:
function colour_links() { $stringToLookFor = "My Dummy"; $stringToReplace = "<strong>My Dummy</strong>"; $wp_list_pages = str_replace($stringToReplace, $stringToLookFor, $wp_list_pages); return $wp_list_pages; } add_filter('wp_list_pages', colour_links);
OK: I’m sure there’s plenty of incorrect code above
I’d appreciate if you could point out where I was going wrongIn the theme I’m using, they use wp_list_pages() to display the top menu
So, I need to write code that overwrites the default actions for this function?All I want to actually do is change the colour of specific menu items (and maybe make them bold) – the names of these will intentionally be hard coded
In the above code, I have simply tried to make bold – just to testI’m a little stuck where to start!
I’ve looked up and there’s a WP hook for ‘wp_list_pages’
(https://adambrown.info/p/wp_hooks/hook/wp_list_pages?version=2.9&file=wp-includes/post-template.php)I’m pretty sure I’m using $wp_list_pages wrongly above
Any help would be great!
Thanks
Omar
- The topic ‘Need help writing a plugin to change my navigation menu’ is closed to new replies.