• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Genesis Snippets

A reference for Genesis theme developers

  • Home
  • Archives
  • Search Genesis Snippets

Template plugin for custom post type with sidebar

June 19, 2018 By David Wang Leave a Comment

I often want to create a custom post type with an accompanying sidebar. For example, a Lessons sidebar that only displays on Lessons and Programs (a related taxonomy). Here is a simple plugin that does just that, or provides a basis for customization. You can also copy the code into your functions.php file directly.

View plugin code, or download plugin.

A couple of points to note:

The plugin some Genesis features to the Lessons post type. Comment out the features you don’t need, or simply delete this block:

add_action( 'genesis_init', 'child_lessons_theme_supports' );
/*
 * Add theme supports to Lessons
 */
function child_lessons_theme_supports() {
	add_post_type_support( 'lesson', array(
		'genesis-cpt-archives-settings',  // Archive settings
		'genesis-layouts',    // In-post layout settings
		'genesis-seo',        // In-post SEO settings
		'genesis-scripts',    // In-post script options
	) );
}

The plugin also removes the post meta and post info by default. If you want these, delete this block of code:

add_action( 'genesis_before', 'child_remove_lesson_meta', 11 );
/*
 * Remove post info and meta for Lessons
 */
function child_remove_lesson_meta() {
	// Remove post info
	remove_post_type_support( 'lesson', 'genesis-entry-meta-before-content' );
	// Remove post meta
	remove_post_type_support( 'lesson', 'genesis-entry-meta-after-content' );
}

Hope you find it useful 🙂

Filed Under: Genesis Tagged With: custom post type, widget areas

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Brought to you by ClickWP
Buy the Genesis Theme Framework

Who’s behind this?

Hi! I'm David and I'm a big Genesis fan. I've been using it in all my projects and have found it to be super powerful.

I started this site to keep track of all the snippets that I've been using in my projects and so that it's easy for me to find them again instead of digging through my old project files.

Help support this site by buying Genesis with our affiliate links. Thanks!

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 354 other subscribers

Browse Snippets

branding cache comments css custom post type doctype entry footer entry header favicon featured image genesis_custom_loop images internet explorer jetpack loop media menu metabox minify navigation oembed page layouts performance plugin integration post thumbnail shortcode sidebars theme options widget areas widgets WooCommerce WordPress
Everything you need to support your online business
Take WordPress further with the Genesis framework

Copyright © 2025 · Genesis Sample On Genesis Framework · WordPress · Log in