I was hoping for some assistance with a custom meta box that I added to my genesis child theme.
The data is being saved properly, and stored properly, but when I try to echo it out using get_post_meta, nothing shows up. But a custom function someone showed me does echo it out. Can someone figure out what it isn’t working?
This should work but doesn’t.
add_action ('genesis_before_post_content', 'gteh_tagline');
function gteh_tagline() {
$meta = get_post_meta($post->ID, $field['dbt_text'], true);
echo $meta;
}
This works but I don’t want to use this, would rather use the proper code
add_action ('genesis_before_post_content', 'gteh_tagline');
function gteh_tagline() {
echo "<pre>";
$customs = get_post_custom(get_the_ID());
$text = (isset($customs['dbt_text'][0]))?$customs['dbt_text'][0]:"";
var_dump($customs);
echo "<br/>text=".$text;
echo "</pre>";
}
It dumps this and echoes it out when asked.
["dbt_text"]=>
array(1) {
[0]=>
string(89) "At vero eos et accusamus et iusto odio dignityr simos ducimus qui blanditiis praesentium "
}
Here is dbt_text
$prefix = 'dbt_';
$meta_box = array(
'id' => 'my-meta-box',
'title' => 'Post Tagline',
'page' => 'post',
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => 'Post Tagline',
'desc' => 'Displayed below the post title',
'id' => $prefix . 'text',
'type' => 'text',
'std' => ''
)
)
);