Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Michael Strand
Michael Strand
10,897 Points

Bootstrap Pills and Tabs

Hello Zac,

I am working on a section of a custom site and it will have the options to choose a country they can order a book from. Once they click on a country I want it to show the different sites that they can order the book from (Amazon, Indiebound, etc.).

I am wondering how I might go about making a custom menu for a specific page that will make a new tab or pill when I add a new menu item and when I click a tab it will show the content for each tab. Could I have each tab display another menu?

Thanks! Michael

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Could you set this up using categories?

Michael Strand
Michael Strand
10,897 Points

I probably could, I really wasn't sure what the best approach would be. So I make a category for each country and then have a post for each online store location?

Michael Strand
Michael Strand
10,897 Points

Zac, The problem I'm still struggling with is the if statement for making the tab class equal to active, but not all of them.

<?php foreach ( $tabs as $key => $tab ) : ?>
    <li role="presentation" class="<?php echo $key ?>_tab active">
        <a href="#tab-<?php echo $key ?>" aria-controls="home" role="tab" data-toggle="tab">
            <?php echo apply_filters( 'woocommerce_product_' . $key . '_tab_title', $tab['title'], $key ) ?>
        </a>
    </li>
<?php endforeach; ?>