Support » Plugin: Post UI Tabs » Shortcode parameters and bookmarking/history

  • Twig


    Hi –

    I’m wondering what parameters (other than “name”) are available to the [tab] shortcode? Specifically can we set the ID or classes on the
    <ul> and <li> items generated by the shortcode without hacking core?

    Also, I’m looking to implement the usual jQ tabs bookmarking/history feature (where the tab ID is put in the window.location.hash), then hooking functions to auto-select a tab based on the URL.

    Is something like that possible with PUT? I know WP UI plugin has some logic like that, but I was trying to avoid that plugin for simplicity’s sake.

    Please let me know what you think! Thanks so much.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mark / t31os


    jQuery UI and UI tabs sets the classes for the list elements, the plugin only produces some simple HTML markup for those items, is there a particular reason you want to set the ID or class for them?

    With regard to bookmarking, i’m not entirely sure i understand, could you go into more detail please.



    Sure – it’s a fairly common requirement that a tab be pre-selected based on the URL (i.e. someone can bookmark a specific tab to be open when they visit a page).

    Usual way to do this is to use the hash (like – the use JQ to extract the hash and select the tab. To do this elegantly, it’s nice if the <a> href is human readable – so rather than #tab1-1, it would be #My-Nice-Tab-Name or whatever.

    With other UI plugins, you can set the ID of each tab (which sets the hash).

    However I wrote a simple workaround using jQ such that it doesn’t need to be in the markup- it uses the text() value of the tab to set the hash. I just wondered if your shortcode exposed any other params than “name” is all.

    Thanks for the follow-up though!

    Plugin Author Mark / t31os


    The tab naming scheme change would be quite reasonable, however what we need to bear in mind is that each set of tabs needs some form of identifier, using the naming scheme you’ve given an example of above does not include any identifier for a set.

    It’s certainly a possibility, but i would need to rewrite areas of the plugin to allow this and also come up with some means of identifying a given set of tabs(can’t think of any immediate solutions off the top of my head – that’s definitely not to say there isn’t one).

    With regard to bookmarking, it should be supported already to some degree, the tabs script does allow tab selection based on the URL(though i do recall one of the plugin options conflicting with this functionality).

    For example, i have 4 sets of tabs shown on the main index of my testing environment, if i visit..

    …the fourth tab in the first set of tabs is selected when i land on the page.

    …the fifth tab in the second set of tabs is selected when i land on the page.

    This only appears to work on the first time you land on the page though and as far as i can tell is a limitation of how the tabs script selects the tab based on the URL, navigating away from said page and back using a different anchor will work(you simply can’t just change the anchor at the end of the URL to change tab if you’re already on said page).

    Which other plugins were you referring to by the way? No reason i can’t take a peek at some of their code for ideas… 😉

    Thanks for your feedback and sorry for the late response, been a little busier than usual.



    I think it’s great that you are so quick to reply – I wish more plugin authors were half as diligent 🙂

    The other plugin with which I’ve had experience is WP UI.

    Nice plugin but more complex than required for simple tab-only sites, and I usually try to add less vs. more until needed.

    I agree on the ID-uniqueness requirement; if you had multiple tabsets on the same page with the same tab titles, it would cause problems. I will just have to cross that bridge when a client makes it for me 😛

    I worked around the “same page tab” issue with a little jQ – basically it looks for any <a> tag containing the current URL and a #, and forces a page reload. That way it mimics the behavior of navigating from a different page, and so selects the correct tab. Since people usually expect a page-refresh when clicking a menu item, I’m fine with this approach for now 🙂

    Plugin Author Mark / t31os


    Food for thought at least and i’ll check out WP UI when i get a reasonable amount of time to sit and disect, if only for inspiration and ideas in the least.. 🙂

    Thanks again for the feedback.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shortcode parameters and bookmarking/history’ is closed to new replies.