Simple code to insert custom field into shortcode. What is wrong?
-
function companylink( $atts, $content = null ) { $link = echo get_post_meta($post->ID, 'companylink', true); return $link; } add_shortcode('companylink', 'companylink');
Any help here would be hugely appreciated. I’m just trying to echo a custom field into a shortcode.
The shortcode will be [companylink] and it should return $link which is just echoing the custom field.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Simple code to insert custom field into shortcode. What is wrong?’ is closed to new replies.