krista-m
12/20/2017 - 12:41 AM

Genesis Setup

Example of custom Genesis setup function from CC Olivia theme

//* Complete the initial theme setup right after Genesis's setup is complete
add_action('genesis_setup', 'olivia_setup', 15);
function olivia_setup() {

	//* Child theme (do not remove)
	define( 'CHILD_THEME_NAME', 'olivia' );
	define( 'CHILD_THEME_URL', 'http://olivia.codedcreative.co/' );
	define( 'CHILD_THEME_VERSION', '1.0.1' );

	//* Add custom theme options
	include_once( get_stylesheet_directory() . '/theme_customizer.php' );
	include_once( get_stylesheet_directory() . '/customizer_styles.php' );

	//* Load widget areas
	include_once( get_stylesheet_directory() . '/widget-areas.php' );

	
	//* Add HTML5 markup structure
	add_theme_support( 'html5', array( '404-page', 'drop-down-menu', 'search-form', 'comment-form', 'comment-list' ) );

	//* Add Accessibility support
	add_theme_support( 'genesis-accessibility', array( 'headings', 'drop-down-menu',  'search-form', 'skip-links', 'rems' ) );

	//* Add viewport meta tag for mobile browsers
	add_theme_support( 'genesis-responsive-viewport' );

	//* Add support for 3-column footer widgets
	add_theme_support( 'genesis-footer-widgets', 3 );

	//* Add support for custom header
	add_theme_support( 'custom-header', array(
		'flex-height'     => true,
		'width'           => 430,
		'height'          => 200,
		'header-selector' => '.site-title a',
		'header-text'     => false,
	) );

	//* Reposition the primary navigation menu
	remove_action( 'genesis_after_header', 'genesis_do_nav' );
	add_action( 'genesis_site_title', 'genesis_do_nav' );

	//* Remove layouts that use secondary sidebar
	genesis_unregister_layout( 'content-sidebar-sidebar' );
	genesis_unregister_layout( 'sidebar-content-sidebar' );
	genesis_unregister_layout( 'sidebar-sidebar-content' );

	//* Unregister secondary navigation menu
	add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) );

	//* Remove secondary sidebar
	unregister_sidebar( 'sidebar-alt' );

	//* Remove the header right widget area
	unregister_sidebar( 'header-right' );

	//* Add new featured image size for the homepage widget
	add_image_size( 'home-latest-posts', 367, 459, TRUE );

	//* Add support for after entry widget area
	add_theme_support( 'genesis-after-entry-widget-area' );

}