display custom filed using do_shortcode in template

today i needed t o display contact form 7 Shortcode into a template

when it was pulled from custom field in the admin panel

so here is the snippets

<?php // echo do_shortcode(‘[contact-form-7 id=”1067″ title=”landing page”]’);?>

<?php
//change “lp_cf7” to the name of your custom field.
$key = ‘lp_cf7’;
//if the field is set within wordpress, continue
if (get_post_meta($post->ID, $key, true)) { ?>
<?php echo do_shortcode(get_post_meta($post->ID, $key, true));?>
<?php }?>

Advertisements

Leave a Reply :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s