WordPress.org

Ready to get started?Download WordPress

Forums

Squelch Tabs and Accordions Shortcodes
[resolved] how to include file in tab? (2 posts)

  1. arpitap
    Member
    Posted 11 months ago #

    Hi there,

    How can I include other template file into tab or write different query for each tab in theme template?

    What I am trying to do is display custom post categories as tabs and posts of that category as tab content.

    If you can please reply asap, it would be really helpful.

    Thanks.

    Cheers,
    Arpita

    http://wordpress.org/plugins/squelch-tabs-and-accordions-shortcodes/

  2. Matt Lowe
    Member
    Plugin Author

    Posted 11 months ago #

    Hi arpitap, check out do_shortcode: http://codex.wordpress.org/Function_Reference/do_shortcode

    e.g.

    echo do_shortcode('[tabs][tab title="Tab 1"]First tab[/tab][tab title="Tab 2"]Second tab[/tab][/tabs]');

    Depending on the data structures you're building you can do something like:

    $sc = '[tabs]';
    
    foreach ($tabsData as $tab) {
        // Obviously this is just an example and you will need to adapt it to suit your data structure(s)
        $sc .= '[tab title="'.$tab->title.'"]'.$tab->content.'[/tab]';
    }
    
    $sc .= '[/tabs];
    
    echo do_shortcode($sc);

Reply

You must log in to post.

About this Plugin

About this Topic