The7 is a multi-purpose WordPress theme that comes with dedicated post types for testimonials, portfolio, photo albums, team, slideshows, and more. But, what if you are using a plugin that adds functionality like a business directory or knowledge base that’s not available in The7 theme? How do you integrate a plugin’s custom post type into The7 so that you can use the default meta boxes? This tutorial will show you how to add The7 theme sidebar to custom post types in WordPress.
Step 1: Discover the WordPress Custom Post Type Name
The first step is to discover the registered public name of the custom post type. You can usually find it by editing or adding a custom post type in the WordPress admin. The custom post type will be visible in the browser address bar. For example, The7’s testimonial post type looks like the following:
NOTE: The7’s post types already use the default meta boxes (which includes The7 theme sidebar).
In addition, another way to determine which custom post types are registered as public and being used by WordPress is to call get_post_types(). Copy and paste the following code to your theme’s functions.php file.
Step 2: Add The7’s Default Meta Boxes to the Custom Post Type
Now that you’ve discovered the custom post type name, the next step is to add The7 theme sidebar to it. The sidebar meta box is part of The7’s default meta boxes. In other words, this includes the Sidebar Options meta box, Footer Options meta box, and Page Margins meta box.
The following code snippet hooks into presscore_pages_with_basic_meta_boxes, which is a filter in The7 theme. Edit line 8 to include your custom post type by replacing custom_post_type. Copy and paste the code snippet into your functions.php file to add The7 theme sidebar. To clarify, all of The7’s default meta boxes will be added to the custom post type.
Final Thoughts: Adding The7 Theme Sidebar to Custom Post Types
Adding the default meta boxes or The7 theme sidebar to a custom post type is not a settings option in The7. Consequently, the code snippet above will need to be used. After that, you can simply include additional custom post types to the same code snippet in the array.
For more information about The7 theme:
Need help? Our WordPress Development Service is a comprehensive solution for small, medium and enterprise-level businesses. Call us at 602-633-4758 for a free consultation.