Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When I create a page with the content as [contact-form-7 id="199" title="Untitled"] , it displays the form, but when I use it as

<div class="first"><?php $recentProjects = get_post('275'); echo $recentProjects->post_content; ?> </div>

it is not working. It is displaying [contact-form-7 id="199" title="Untitled"] instead of form.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This is correct behaviour. A simple echo will just return the field from the DB, unmodified.

if you want to render the shortcode try

<div class="first"><?php $recentProjects = get_post('275'); echo do_shortcode($recentProjects->post_content); ?> </div>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.