I'm using the WP Alchemy class to add custom metaboxes to templates in the admin panel and pull results from those metaboxes into the theme front-end. Here is the relevant code in content-link.php (in the loop - in Twenty Eleven Theme).
<a href="<?php display_url_info(); ?>"><img src="http://localhost/wordpress/wp-content/uploads/2011/08/external-link-red03.png"/></a>
Right now the link shows just the permalink instead of the url in the metabox. If I hardcode a url in there instead, the custom url shows up on the post. I've verified it being properly stored under _custom_meta in the db (and successfully implemented metabox display in other templates. Here's the value in the db:
a:1:{s:5:"links";a:1:{i:0;a:2:{s:6:"domain";s:25:"http://stackexchange.com/";s:13:"post_link_url";s:48:"http://wordpress.stackexchange.com/questions/ask";}}}
Here's my plugin file:
$basic_metabox = new WPAlchemy_MetaBox (
array (
'id' => '_custom_meta',
'title' => 'Basic Meta',
'template' => ABSPATH . 'wp-content/themes/beernews-child-theme/custom/basic-meta.php',
'types' => array('post','link')
)
);
add_filter('beernews-child-theme_post', 'display_url_info');
function display_url_info() {
// usually needed
global $basic_metabox;
// get the meta data for the current post
$basic_metabox->the_meta(); ?>
<?php if ($basic_metabox->get_the_value('post_link_url')) {
echo $basic_metabox->the_value('post_link_url');
}
}