• Resolved pacificocean01

    (@pacificocean01)


    Hi,
    I introduce the shortcode for the tabs on my index.php in a child theme of the twentysixteen theme. The code appears on the homepage as if it would be a normal <p></p> without recognizing the code. The thing is that if I use it on a post it works fine but not in the index and neither in a page, as I tried to post it on a page and then call it from the index without success. Does anyone have a suggestion?

    Thank you a lot.

    https://wordpress.org/plugins/tabby-responsive-tabs/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author cubecolour

    (@numeeja)

    Adding a shortcode on its own in a template won’t work. To invoke a shortcode in a php file such as a theme template, you would need to echo the output of the do_shortcode function.

    Try something like:

    <?php
    
    echo do_shortcode('[tabby title="first tab"]');
    
    echo 'Replace this with the content of the first tab.';
    
    echo do_shortcode('[tabby title="first tab"]');
    
    echo 'Replace this with the content of the second tab.';
    
    echo do_shortcode('[tabbyending]');
    
    ?>
    Thread Starter pacificocean01

    (@pacificocean01)

    That worked for me, there was a misspell on tabbyending”, I re-type for next users:

    <?php echo do_shortcode('[tabby title="first tab"]');
    echo 'text1';
    echo do_shortcode('[tabby title="second tab"]');
    echo 'text2';
    echo do_shortcode('[tabby title="third tab"]');
    echo 'text3';
    echo do_shortcode('[tabbyending]'); ?>

    Thanks a lot!

    Plugin Author cubecolour

    (@numeeja)

    Great – thanks for catching my typo – I’ve corrected my post above.

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

The topic ‘Tabs not working on index.php’ is closed to new replies.