WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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
Really saved my time.thx a lot. – Vijaya Narayanasamy Feb 7 '15 at 7:37

Your Answer


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.