My go to guy is recuperating from heart surgery so I jumped into something today on my own. So far I haven't broken anything but I got stuck.
I am using Wordpress. I have several custom fields for each post. What I am working on doing is placing a php widget in the sidebar that grabs some of the data from the custom fields and displays the data in the sidebar.
Here's what my code looks like:
<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, '411_bus_name', true);
echo "<br />< br/>";
echo get_post_meta($postid, '411_bus_descrip', true);
echo "<br /><br />";
echo "<h5>Contact</h5>";
echo get_post_meta($postid, '411_bus_address', true);
echo "<br />";
echo get_post_meta($postid, '411_bus_phone1', true);
echo "<br />";
echo get_post_meta($postid, '411_bus_phone2', true);
echo "<br />";
echo get_post_meta($postid, '411_bus_email', true);
echo "<br />";
echo get_post_meta($postid, '411_bus_website', true);
wp_reset_query();
?>
The above works just fine, but it's not quite what I want. For the email data, I want to set up a link, where say the word 'Email' is linked to the data grabbed by get_post_meta($postid, '411_bus_email', true).
I've played for hours and got close but not close enough. The closest I've got is:
echo "<a href=\"mailto:\" ' .get_post_meta($postid, '411_bus_email', true). ' \">Email </a>";
The above works, sort of. It sets up the link, but the link only shows: mailto:
I just can't seem to figure out how to put it all together.
Any help provided will be greatly appreciated.