WiscWeb - WordPress UW Theme - Issues with Multiple Tabbed Content Groupings on One Page

The following doc discusses an issue with the Tabbed Content page element whereby you cannot add more than one tab with the same name on a page.

Issue 

When adding Tabbed Content groupings to your page, your tabs will error out if you have more than one tab of the same name on the page. The way this error displays will differ, but typically, the second grouping (with the same tab names) will not show content as expected. The most common example is that the first tab of the second grouping will not show up until you click on the tab.

An example is when you want to have more than one tab groupings with the same list of tab names.

FirstTabGrouping.png
SecondTabGrouping.png

Reason

The Tabbed Content page element is designed to assign an ID (based on the title) to each tab created. If you have more than one tab on the page with the same title, you will have more than one reference on the page to the same ID. Your browser will not know how to interpret this error because it is not valid HTML. Each ID on the page must be unique. 

The structure of the tab ID is as follows:
id="tabnameinlowercaseletters - label"

In the example above, where both tab groupings have a tab named "One," both will have the following ID listed:
id="one-label"

Resolution

The best way to resolve this issue is to make sure each tab on the page has a unique title.

For example, if you have tabbed groupings for each semester (titled Spring, Summer, Fall, and Winter), consider adding the year to each tab, as well. This will alter the ID of the tab to make it more unique.

Example:

Title for first grouping, first tab: Spring 2020
ID for first grouping, first tab: spring-2020-label
FirstTabGrouping_Revised.png

Title for second grouping, first tab: Spring 2021
ID for second grouping, first tab: spring-2021-label
SecondTabGrouping_Revised.png


Troubleshooting

  • Consider using the Accordion page element instead:

    Accordion panel example

    Accordion Panels allow you to have a series of editable text blocks for you to add to your site. Each panel expands and contracts to allow you to display a lot of information that stays hidden unless a person selects a panel. You can add text, media, or embed third party code (e.g. YouTube) to display in your accordion panels.

    Layout Availability

    Accordion Panels are available in One and Two Column Content Layouts.

    Best Practices

    • You should not use Accordion Panels if you need to directly link to the content of one of the panels. Any information that requires a direct link should be its own page and not a panel. You cannot directly link to a specific panel.

    Adding an Accordion Panel

    1. Navigate to the page on which you want to add an Accordion Panel.
    2. Scroll to the Primary Content Area and the Layout on which you want to add an Accordion Panel.
    3. At the bottom of that Layout, click on Add Page Element.
    4. On the Page Element list, click on Accordion Panel.

    Using an Accordion Panel

    Accordion Panels have two fields for you to fill out, the title and the text area. The title will appear at the top of the panel and displays when it is open or closed. The text block appears beneath the title and functions the same as the Text Block Page Element. For all of the options available in the Text Block, see WiscWeb - WordPress UW Theme - Text Block Page Element.

    default accordion panel screen in wordpress

    Adding and Rearranging Panels

    There are two ways to add new panels.

    • Add Accordion Panel Button: This button appears at the bottom of all of your panels. Clicking it will add a new panel at the bottom of your Accordion Panels.
    • The Plus (+) and Minus (-) Symbols: On the right side of each panel, mousing over the gray strip will show a plus (+) symbol and a minus (-) symbol. Clicking the plus (+) will add a panel above the panel you've selected, and clicking the minus (-) will add a panel below the panel you've selected.

    plus and minus symbols appearing in the accordion area

    You can also rearrange the panels after you've added them. To do this, mouse over the left column and you'll see numbers appear. These numbers coincide with the order of the panels as they appear on the page. Click and drag the panels to where you want them to appear. For example, if you want the third panel to appear second, navigate to the third panel, click and drag in the left column to above the second panel, and release the mouse. This should move the panel from third to second, and the second panel should now be third.

    display of the number column which can be dragged to a new order


    Demonstration Video (no audio)

See Also: