最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - Add shortcode in my div

matteradmin9PV0评论

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:

/?page_id=19

Just look at this moment ...

What needs to change to run this shortcode?

Thanks in advance!

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:

http://avocat.dac-proiect.ro/wp/?page_id=19

Just look at this moment ...

What needs to change to run this shortcode?

Thanks in advance!

Share Improve this question asked Feb 21, 2015 at 22:24 CristiCristi 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 2

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far