I was trying to create a shortcode for a multiple tabs panel. The user can set the number of tabs, the titles and the content for each. It would be something like :

[tabs number='4']

[tab title='First_tab_title']first tab content[/first_tab]


Now, i am wondering. Although it can be done like this, i don't like that i have to create separate shortcodes, like tabs and tab. Is there another better way to pass all this information to a single [tabs] shortcode ?

  • I wouldn't use shortcodes like this. Why don't you make a TinyMCE plugin instead? Commented Jul 20, 2011 at 21:18
  • i have a tinymce plugin, i'm not gonna do it by hand. But the output of the shortcode must be like this. It has to be a shortcode in this situation.
    – SpyrosP
    Commented Jul 20, 2011 at 22:26

1 Answer 1


You might be able to hack a conditional for 1 shortcode but it seems wonky. Typically you use 2 parameters just like you were using raw html.

There is a smart way around this using custom fields ( which I just happened to do recently).

It does not use any shortcodes at all, the logic is simple it has a custom fields called "tab 1, tab 2, tab 3 , etc" , if no data is entered no tab panels shows up, if there is data in the tab field the panels shows up and dynamically adds tabs per field that is filled out.

I just use jquery tools for the tab panel and default WordPress conditionals for the meta fields, get_post_custom_values specifically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.