Thanks for the reply, vtxyzzy … I like your code better than my previous code because it only shows the dash if there’s a subtitle.
Unfortunately though the value for $subtitle is still not showing on the browser page.
I looked at the database to make sure the value is in the table, and it is:
meta_id post_id meta_key meta_value
9371 1662 ArticleID 54321
9369 1662 Subtitle here’s the subtitle
9344 1662 _edit_last 1
9343 1662 _edit_lock 1276931207
Note the meta_key starts with a capital letter ‘Subtitle’, so I adjusted the variable declaration in the php code.
// add subtitle to posts and pages
function vg_subtitle($posttitle) {
$subtitle = get_post_meta ($post->ID, 'Subtitle', true);
echo $posttitle;
if ($subtitle) echo ' - ' . $subtitle;
}
add_action('thematic_postheader_posttitle','vg_subtitle');
I just cannot figure out why the value isn’t being retrieved. I see in the WordPress Codex and in some online tutorials mention of placing this code in The Loop. I’m pretty sure my function is in “The Loop” because I’m adding it to ‘thematic_postheader_posttitle’, which is called from ‘thematic_postheader’, which is called from ‘thematic_index_loop’, which appears to have the adequate ‘Loop’ structure (and everything else it’s calling does work) …
Here’s ‘thematic_postheader_posttitle’, from ‘wp-content/themes/thematic/library/extensions/content-extensions.php’:
// Create post title
function thematic_postheader_posttitle() {
if (is_single() || is_page()) {
$posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n";
} elseif (is_404()) {
$posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n";
} else {
$posttitle = '<h2 class="entry-title"><a href="';
$posttitle .= get_permalink();
$posttitle .= '" title="';
$posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
$posttitle .= '" rel="bookmark">';
$posttitle .= get_the_title();
$posttitle .= "</a></h2>\n";
}
return apply_filters('thematic_postheader_posttitle',$posttitle);
} // end thematic_postheader_posttitle
But, is it possible I’m adding this ‘vg_subtitle’ action incorrectly? Or that I have something missing in the variable declaration that I need for the value to be retrieved?
Any help is greatly appreciated. Thank you.