I have the following that works fine..
elseif( get_post_type($post->ID) == 'press' ){the_title_attribute();}
However, i need the aforementioned title to be wrapped with a h2 tag.
Tried this but it just puts the h2 after the title...
elseif( get_post_type($post->ID) == 'press' ){echo'<h2>'. the_title_attribute() .'</h2>';}
Any ideas?
Many thanks for any help :)
the_title_attribute()rather thanthe_title()? – Chip Bennett Apr 13 '11 at 11:08the_title_attribute()is intended for outputting the Title specifically formatted for use in thetitleattribute of an anchor tag; on the other hand,the_title()is intended for general output of the Title. For your use case, you could specifically useget_the_title(), which returns, rather than echoes, the string. – Chip Bennett Apr 13 '11 at 12:37