I want to call custom field in single.php template to complete a short code and thus show a menu.
I places the below code but it is not working
<?php echo do_shortcode("[custommenu menu=<?php echo get_post_meta($post->ID, ‘tabmenu’, true); ?>]?>")
I believe you forgot to add quotes around the menu parameter.
<?php $post_meta_value = get_post_meta($post->ID, 'tabmenu', true);
echo do_shortcode('[custommenu menu="'.$post_meta_value.'"]'); ?>
Try using this code. Hope this will work.
$post_meta_value = get_post_meta($post->ID, 'tabmenu', true);
echo do_shortcode('[custommenu menu='.$post_meta_value.']');