Formatting Post Titles and Menu Links

This may be a question for another area, but I have a client who has a specific look he wants for the links in the menu and the page titles. he did them all as 2 words and would like them to follow this format: linktitle (first letter in normal font, second word in bold font). Is there a good way to do this? I’m thinking there has to be a php function that could do this fairly easily (find the space and then replace the space with a strong element and put a closing strong element at the end). I’d appreciate the help on this one, the client is very adamant about this design element.

Not exactly sure what you want but:

$title = preg_replace(/(\w+)\s(\w+)/, '$1<strong>$2</strong>', $original_title);

Just matches 2 words separated by a space and replaces it with ‘firstwordsecondword’.

That’s perfect. Exactly what I want to do. How can I wrap this as a function in custom.php and then hook into it in the places where I need it (nav and page titles)?

You need to use the_title filter, which you’ll find more about on the WordPress codex.

If I understand the Codex correctly, the_title is only useful in the loop for posts. Fine for part of my problem, but how can I hook into the Nav menu?

This really isn’t Roots related at all. I know it’s an easy place to get help if you’re using Roots but we’re really trying to keep this forum on topic.