/ Published in: PHP
URL: http://digwp.com/2009/10/custom-fields-for-html-post-titles/
Expand |
Embed | Plain Text
1. Enter title without HTML 2. Create a custom field for the title with HTML 3. Output custom field on pages you want the HTML For example, on the single.php page where you would have used <h1><php the_title(); ?></h1> Now you use <?php $html_title = get_post_meta($post->ID, "HTML_title", true); if ($html_title) { ?> <?php } else { ?> <h1><?php the_title(); ?></h1> <?php } ?> This checks and sees if that custom field is set. If it is, it outputs that. If not, it uses the regular function. Because the RSS templates use the regular the_title() function, your titles are same from being weirdified in feed readers.
You need to login to post a comment.
