Hello,
I am trying to create a speaking block navigation as seen here: http://www.smashingmagazine.com/2008/02/26/navigation-menus-trends-and-examples/
So for example: I can have a main title and some descriptive stuff right below but I would only want the main title to appear in page headlines without the descriptive text.
I'm using the Thematic framework so my functions.php in my theme looks like:
// shortcode [menusmall]navigation[/menusmall] to add span="menu_small" to navigation menu items
function menu_small_shortcode( $atts, $content = null ){
return '<span class="menu-small">' . $content . '</span><br/>';
}
add_shortcode('menusmall', 'menu_small_shortcode');
add_filter('the_title', 'do_shortcode');
// strip the shortcode [menusmall] from the document title.
function strip_menusmall($content) {
$patterns = array();
$patterns[0] = '/\[menusmall\]/';
$patterns[1] = '/\[\/menusmall\]/';
$replacements = array();
$replacements[0] = '';
$replacements[1] = '';
$content = preg_replace($patterns, $replacements, $content);
return $content;
}
add_filter('thematic_doctitle', 'strip_menusmall');
add_filter('thematic_doctitle', 'do_shortcode');
However, this method presents a problem whenever the_title is referenced so I'm stripping out the shortcode but there's got to be a better way.
Can someone point me in the right direction? Thanks.