Okay
  Public Ticket #482697
Shortcodes in template part
Closed

Comments

  • Mike started the conversation

    Is it possible to use the do_shortcode() method inside a template part? In particular I have a custom post type (being displayed using a child theme) where I want to populate a 'toggle'. I tried to use

    <?php echo do_shortcode("[toggles]");

    ...but I dont know if that shortcode is recognized by the API. If if *did* work, would I then have to "close" the shortcode

    <?php echo do_shortcode("[/toggles]");

    I have limited experience creating custom templates in WP, please pardon my ignorance.

  •  8,853
    Tahir replied

    Hey,

    Try adding the shortcode in the page as you want and then copy paste it in the do_shortcode php function. Make sure you are using single quotes inside the shortcode text.

    Thanks


    ThemeNectar Support Team