Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1294423

    Hi,
    While I was creating a list of tabs, I made sure to paste the tab name into the “Custom ID Attribute” field as well. However, upon save, the tabs didn’t work. I added “add_theme_support(‘avia_template_builder_custom_tab_toogle_id’);” to my child theme’s functions file but doing that wiped out the Custom ID Attribute fields and they are now all blank. I don’t want to go through and copy and paste the title into that Custom ID Attribute for each one. Is there a function that would automatically take the tabs title and add it to the Custom ID Attribute field? If so, that would be awesome!.

    Thanks in advance!

    #1294859

    Hey waxingmedia,

    So you are using the Tabs element, and the IDs you are using in the Advanced Tab is not working? If so, then can you give us an example of an ID which is not working please?

    There is no function to automatically populate the custom ID field unfortunately.

    Best regards,
    Rikard

    #1295054

    Hey, Rikard
    I figured out a solution and will post it below for others that may want to do this.
    I modified a copy of the shortcode tabs.php
    Around line 626, find this:
    $output .= ‘<div aria-controls=”‘ . $tab_atts[‘custom_id’] . ‘-content” role=”tab” tabindex=”0″ data-fake-id=”#’ . $tab_atts[‘custom_id’] . ‘” class=”tab ‘ . $titleClass . ‘” ‘ . $markup_title . ‘>’ . $icon.$tab_atts[‘title’] . “</div>\n”;

    and replace with this:

    $tab_atts[‘customtabtitle’] = $tab_atts[‘title’];
    $tab_atts[‘customtabtitle’] = strtolower($tab_atts[‘customtabtitle’] );
    $tab_atts[‘customtabtitle’] = str_replace(‘ ‘, ‘-‘, $tab_atts[‘customtabtitle’] );
    $output .= ‘<div aria-controls=”‘ . $tab_atts[‘custom_id’] . ‘-content” role=”tab” tabindex=”0″ data-fake-id=”#’ . $tab_atts[‘customtabtitle’] . ‘” class=”tab ‘ . $titleClass . ‘” ‘ . $markup_title . ‘>’ . $icon.$tab_atts[‘title’] . “</div>\n”;

    This creates a new variable called $tab_atts[‘customtabtitle’], assigns it to $tab_atts[‘title’];, converts it to lowercase and then replaces the spaces with underscores. Then data-fake-id=”#’ . $tab_atts[‘custom_id’] now becomes data-fake-id=”#’ . $tab_atts[‘customtabtitle’]

    So now whatever you name your tabs, e.g., “This is my tab name”, it will also output that name as “this_is_my_tab_name”. Just be aware that anything custom you put in your custom ID field will be ignored as that code is not longer outputting in tabs.php. It is now outputting $tab_atts[‘customtabtitle’] which is generated from the title, $tab_atts[‘title’].

    thanks again!

    #1295658

    Hi waxingmedia,

    Great, I’m glad that you found a solution, and thanks a lot for sharing it. It’s much appreciated :-)

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.