• batorowicz

    (@batorowicz)


    Hi,

    I trying embed shortcode in my template:

    <?php echo do_shortcode('[wc_toggle title="test" layout="box"][/wc_toggle]') ?>

    but it not working. on my page I see only:

    [wc_toggle title=”test” layout=”box”][/wc_toggle]

    Is there possible do that?

    https://ww.wp.xz.cn/plugins/wc-shortcodes/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just wondering, did you get anywhere with this? I’m having the exact same problem, only the other shortcodes I have tried from this plugin work perfectly in the same function. So [wc_button type="primary" url="http://webplantmedia.com" title="Visit Site" target="self" position="float"]Sample Content[/wc_button] will work, but [wc_toggle] won’t, even if they’re both in the same do_shortcode() function.

    Thread Starter batorowicz

    (@batorowicz)

    No, unfortunately I didn’t.

    I think I found a solution, a couple of days ago. I forgot I had posted on here, otherwise I would have shared this earlier.

    My data that I want to appear ([wc_toggle][/wc_toggle]) is stored in a custom meta field, which is then brought into my template where needed. Instead of using do_shortcode, I found that <?php echo apply_filters( 'the_content', get_post_meta( get_the_ID(), 'custom_field_name', true ) ); ?> works. I think replacing the get_post_meta function with your own content would do the same job.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘shortcode in template ?’ is closed to new replies.