The Stiz Media, LLC

Making your website work for you

  • Styles for Genesis
    • FAQs
  • Cart
  • My Account
  • Home
  • Web Design
  • Portfolio
  • Resources
  • Blog
  • Contact

Powerful websites, with style.

Home » Blog » Tabbed Content Page Template In Genesis

Tabbed Content Page Template In Genesis

January 7, 2015 Andhi 21 Comments

Tabbed Content Page Template

This tutorial will help you setup a custom page template with jQuery ui tabs setup as the main content area.

There are lots of plugins available that allow tabbed content areas in your posts or pages, but they are all a bit bloated to me. The jQuery that’s included in WP already has tabs built in, so why load extra stuff?

This tutorial gives you the basics of setting up a page template with tabs. From here, you can customize however you’d like. You can put ACF fields in your tabs, or shortcodes from other plugins like Easy Digital Downloads or WooCommerce for account and purchase history.

UPDATE: Once you get your template setup, view Part 2 to learn how to load content with ajax in your tabs.

UPDATE 2: If you are using ACF Pro, I built a nice little plugin to have nested tabs with a few great settings. Check out ACF Tabbed Content plugin on GitHub.

Create the page template

Create a file in your Genesis child theme called something like page_tabs.php.

At the top of the file you must include the Template Name tag in order for WordPress to recognize it as a template.

/**
* This file adds the tab template to your.
*
* @author Mike Hemberger - @JiveDig
* @link http://thestizmedia.com
* @package Genesis child theme
*
* Template Name: Tabs
*/

The final code will be in a snippet later in the post, so don’t worry about copying it yet unless you are trying to follow along part by part.

Setup tabbed content markup

jQuery tabs require a div wrapped around everything in order for the javascript to target it correctly. We will remove the default content from our template, create the tab markup and put the page content into the first tab. In your template you can remove the default content altogether, or put it before/after the tabs… whatever you want to do.

We use an unordered list to create the tabs themselves. Each list item has an anchor link that calls a specific div ID.
It’s important that you make sure your href’s are calling the correct div ID in the content area.

The .tsm-tab-content div is only there for styling later on, it’s not needed to make things work. Inside of you content divs can be anything you’d like. The tab world is at your fingertips!

Load the javascript

Next we need to load our tiny javascript file and make sure we include jquery-tab-ui in the process.

First, create a js file in your child theme. I call mine tsm-tabs.js. Put it somewhere organized, like in /child-theme/assets/js/ or just /child-theme/js/. If you’re using a Studiopress child theme there may already be a /js/ directory in the theme.

Inside that file is only a few lines of code. The only thing you need to do is make sure the div ID is the same as the main wrapper div in our page template. The content of the js file is as follows…

Now we need to enqueue the file we just created. We will make sure jQuery loads the tab files, and load it all in the footer. Here is the code to load our javascript file.

Put in your content

That’s all there is too it.

Put your content right in your template file, or use something like Advanced Custom Fields to create fields for your tab contents.

The Final Code

Once the template is setup, create a page inside WordPress and choose your new template for your page in the sidebar select box.

Here is the final code for our template with some dummy content in there.

Happy coding!

Here is some basic CSS to match the demo video.. it should be a good starting point for you.

Related Posts

  • A really organized life
    Genesis Page Templates in a subdirectory
  • Remove Avatar
    Remove Avatar from Genesis Author Box
  • Remove The Comma Between Categories And Tags In Genesis

Tutorials Genesis, Page Templates, Tabs

‹ Remove Avatar from Genesis Author Box
Tabbed Content via AJAX in Genesis ›

Try The Most Powerful Genesis Child Theme Ever Created

Mai Theme is the most customizable Genesis child theme (and plugin!) available. Check it out now!

Learn More @ MaiTheme.com

Our posts, directly to your inbox

Comments

  1. Dorian Speed says

    January 7, 2015 at 5:06 pm

    Another great tutorial! Every time I read one of these, I want to dream up a reason to implement it right away. I really like the idea of creating a page template that uses custom fields to populate the tabs.

    Reply
    • JiveDig says

      January 10, 2015 at 2:25 am

      Thanks Dorian! Yes this one is great front end user profiles or specific custom post type stuff where there is a lot of fields and a lot of data that you need to keep organized on the post.

      Reply
      • Dorian Speed says

        January 11, 2015 at 4:10 am

        Quick question – trying to implement this on a site that has the Genesis Tabs plugin installed (used on a different page). It’s applying styles to the tabs on my nice new page template, even with Carrie’s Genesis Style Trump plugin installed. Do you have an approach you would recommend for this situation?

        Reply
      • Dorian Speed says

        January 11, 2015 at 4:19 am

        Disregard previous comment – I think I’ve figured out all of the places in the plugin’s CSS that were overriding the theme’s stylesheet.

        Reply
  2. Craig Grella says

    January 8, 2015 at 10:48 am

    Great tut, thanks! This will come in handy for a few sites I’m working on. Quick question, how might this be modified to allow for easy printing of the individual tabs is a user selects to print these pages?

    Reply
    • JiveDig says

      January 10, 2015 at 2:24 am

      Hey Craig, I’m not sure of the best solution here. I would assume it would require javascript printing only the contents of each tab’s specific ID. Something like this: http://stackoverflow.com/questions/2255291/print-the-contents-of-a-div
      In my example it would target #tab_2, and #tab_3, etc…

      I’m no expert in print stuff or JS though, so I can’t help much more than that!

      Reply
  3. Chrissy says

    May 9, 2015 at 2:36 am

    Awesome info thank you! I love the Genesis community so much there is such good content out there for everyone. Question: Do you have to hard-code the page tabs in php? I plan on using this for my own site so it’s not a big deal, but I’m thinking if I wanted to create something like this for the future for clients to modify….any thoughts on that? Again thanks for the great info!

    Reply
    • JiveDig says

      May 11, 2015 at 1:03 pm

      Thanks Chrissy… best bet IMO would be to use something like Advanced Custom Fields or CMB2 to put metaboxes on the page you are editing. That way you can add whatever content you want via the WP backend.

      Reply
  4. Ciaran Whelan says

    May 19, 2015 at 12:28 am

    What would be good to see is this tutorial use ACF Pro for content blocks. If content is in the content fields of ACF for a page, then it adds a tab to the content and renders out the ACF field in the new tab.

    A scenario will be for tutorials, the tabbed content could be video and another for files related to the post/page

    Ciaran

    Reply
    • JiveDig says

      May 19, 2015 at 11:48 am

      Hey Ciaran, thanks for stopping by. You’re right, ACF is great to use in this situation… it’s basic the flow for ACF though.. just add the field group to your Page, and use get_field or get_post_meta inside the tab content to grab the data. Maybe if I get time i’ll add another tutorial with more detail.
      Thanks!

      Reply
  5. charles says

    July 20, 2015 at 4:57 pm

    Love this, thanks for posting it! . Question- I am trying to to put shortcode output in the tabs using do_shortcode and the tabs (after the first) are not accommodating the shortcode output. You can see it here: http://upssealbeach.com/209-2/ Any ideas? I’ve had this problem using shortcodes in tab plugins as well.

    Reply
    • JiveDig says

      July 20, 2015 at 5:18 pm

      Not sure what’s going on. Can you paste your code in a Gist or snippi.com?

      Off the top of my head, i’m guessing you may have to use output buffering in your shortcode.

      Reply
  6. Brooke Lovett says

    December 15, 2015 at 4:55 am

    Great tutorial! One question, is the content hardcoded with the template file or will it work on by inserting by adding the div class on the visual editor when creating a page or post?

    Reply
    • JiveDig says

      December 15, 2015 at 9:36 am

      Thanks Brooke! It technically could work in the editor, but you’d have to modify it a bit. And you’ll still need to enqueue the javascript file somehow.

      Reply
  7. Ernesto says

    May 19, 2016 at 6:44 am

    How can I add this tabbed content to a section of my homepage? Thx!

    Reply
    • JiveDig says

      May 19, 2016 at 10:43 am

      The main stuff is all in tsm_do_tabbed_content() function. You can just use that function in your front-page.php template as-is. As long as you enqueue the js file there.

      You could also make the whole thing a shortcode, but not sure if that would be worth it. You’d have to decide.

      Reply
  8. karjaw says

    July 8, 2016 at 6:37 am

    Hi jiv, look easy but, its too much for me. btw, can you make it to plugin?

    sorry my english bad im from indonesia.

    Reply
    • JiveDig says

      July 12, 2016 at 11:30 am

      Hi Karjaw. Each use of tabs is so different, not worth a plugin IMO. There are a bunch of tab plugins in the repo though, one of those may work for you.

      Reply
  9. Susanta Kumar Sahoo says

    April 5, 2018 at 12:44 am

    Thanks for the great guide!

    I’d like to show multiple posts from each category/tag as shown here: https://www.beach.com/

    What exactly should I do to achieve that functionality?

    Reply
  10. Scot MacDonald says

    February 20, 2019 at 3:03 pm

    Mike

    Great tutorial. Currently have this working nicely but wondered if there’s a way to point to one of the tabs with a distinct url? I’ve tried but it always loads on the opening tab.

    Sample: http://myurl/page/#tabs-2/ will always revert to /page/#tabs-1.

    Thanks

    Reply
    • JiveDig says

      February 20, 2019 at 3:18 pm

      Hey Scot, I don’t think jQuery Tabbed UI allows this out of the box. I actually just updated the tutorial with a link to a little plugin I built that uses ACF Pro to build nice tabbed groups. It may work for you. If not, it shows another script that I’ve been using lately that allows this. Check it out!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Our posts, directly to your inbox


Howdy, I'm Mike Hemberger. I like to build nice websites and web apps with WordPress and Genesis Framework.

I'm passionate about everything I do, and it resonates in all of my work.

Feel free to email, and you'll be speaking directly with me.

Recent Posts

Restful P2P Example

Create Posts 2 Posts ‘connections’ with the WordPress Rest API

EA Share Count SMS button

Add SMS share button to EA Share Count plugin

ACF Extras

ACF Extras officially launched! A community of code snippets and field groups

Remove Items from TinyMCE editor

Remove Buttons/Items From The WordPress TinyMCE Editor

  • My Account
  • Affiliate Area
  • Log In|Log Out
  • GitHub
  • Instagram
  • Twitter
  • YouTube

Copyright © 2025 · The Stiz Media, LLC · All Rights Reserved