WordPress.org

Ready to get started?Download WordPress

Forums

How To Add Comments Function Inside Shortcode In Theme (1 post)

  1. woood77
    Member
    Posted 2 years ago #

    Hello,

    I'm trying add the comments area of my posts to a tab by using a tab plugin.

    I'm using the following code which was provided by the plugin developer in my template file to accomplish this, but I can seem to figure out how to add a function inside this shortcode code.

    <?php
    do_shortcode("[tab name='Tab 1']{$content}[/tab]");
    do_shortcode("[tab name='Tab 2']{$serviceInfo}[/tab]");
    do_shortcode("[tab name='Tab 3']Condolences Here[/tab]");
    echo do_shortcode('[end_tabset]');
    ?>

    The 3rd line is giving me the trouble. Instead of "Condolences Here" I'd like to add the comments_template() function to the 3rd line so my comments appear on the 3rd tab. However it doesn't work. I want it to look something like this:

    do_shortcode("[tab name='Tab 3']comments_template()[/tab]");

    I can't figure out how to allow this php function inside the do_shortcode function.

    Thanks for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic