I want to add a shortcode in a div created by me in my theme

This is the div:

 <?php if(!is_home()): ?>

          <div id="cristi"><?php echo get_the_content(1); ?></div> 

  <?php endif; ?>

This is the shortcode:

[contact-form-7 id="54" title="Contact form 1"]

This is the link:


Just look at this moment ...

What needs to change to run this shortcode?

Thanks in advance!


You need the do_shortcode() function

<?php echo do_shortcode("[contact-form-7 id="54" title="Contact form 1"]"); ?>

I have not tested your shortcode.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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