Genesis Tutorials

Tips, Tricks, and How-tos for the Genesis Theme Framework

  • The Genesis Developer’s HandbookVisual Hook Guide
  • code, settings & options oh my!Resources
    • Collection Of CodeSnippets
    • Under ConstructionGenesis Functions
    • Coming Soon…Utilizing Genesis SEO Options
  • Extend GenesisPlug-ins
    • Genesis Post Teasers
    • Genesis Favicon Uploader
  • Genesis Child ThemesThemes
  • What is genesistutorials.com?About
    • Genesis Tutorials Roadmap
You are here: Home / Tutorial / How to Define Genesis default options

Tutorial

How to Define Genesis default options

August 10, 2010 by Christopher

Facebook0
Google+0
Twitter0

So was browsing twitter today and saw this http://twitter.com/bpmore/status/20822795914

Is it possible to define presets for #GenesisWP so that when I add new sites, I don’t have to check/uncheck various settings?

It sure is!

drop this function in your child theme’s function.php

add_filter('genesis_options', 'define_genesis_setting_custom', 10, 2);
function define_genesis_setting_custom($options, $setting) {
	if($setting == GENESIS_SETTINGS_FIELD) {
		$options['nav_type'] = 'categories';
	}
	return $options;
}

The code above will set the main navigation to use categories instead of pages ( as set by default in genesis options. )
['nav_type'] is the option want to set and 'categories' is the value.

Genesis is a great framework and has some even greater settings and options. However, it may not always be the best idea for the options to be available for a client. Sometimes to many options may be overwhelming or curiosity may strike and experimentation begin.

With this code you can set all the default values for the Genesis options and hide the menu to access them. This is great for those curious clients that love checking and unchecking boxes or not having to worry about supporting multiple layouts. Hiding the extra options and setting the default values allows your site to be kept the way you set it up to be and helps decrease the chance of an email saying that something has broken on the site (by the client messing with options; can’t promise keeping your code from breaking).

*tip – Besides defining the options to just keep clients from changing things around, this filter is also very helpful for batch genesis site making. Quickly set options for themes by just dropping your predefined options into each your child theme’s function.php.

Define Default Options

The code below is to set all the options within Genesis Settings. Each option in the list below is using the default values.

// Define Genesis Options
add_filter('genesis_options', 'define_genesis_setting_custom', 10, 2);
function define_genesis_setting_custom($options, $setting) {
	if($setting == GENESIS_SETTINGS_FIELD) {
		$options['update'] = 1;
		$options['blog_title'] = 'text';
		$options['header_right'] = 0;
		$options['site_layout'] = 'content-sidebar';
		$options['nav'] = 1;
		$options['nav_superfish'] = 1;
		$options['nav_home'] = 1;
		$options['nav_type'] = 'pages';
		$options['nav_pages_sort'] = 'menu_order';
		$options['nav_categories_sort'] = 'name';
		$options['nav_depth'] = 0;
		$options['nav_extras_enable'] = 0;
		$options['nav_extras'] = 'date';
		$options['nav_extras_twitter_id'] = '';
		$options['nav_extras_twitter_text'] = 'Follow me on Twitter';
		$options['subnav'] = 0;
		$options['subnav_superfish'] = 1;
		$options['subnav_home'] = 0;
		$options['subnav_type'] = 'categories';
		$options['subnav_pages_sort'] = 'menu_order';
		$options['subnav_categories_sort'] = 'name';
		$options['subnav_depth'] = 0;
		$options['feed_uri'] = '';
		$options['comments_feed_uri'] = '';
		$options['redirect_feeds'] = 0;
		$options['comments_pages'] = 0;
		$options['comments_posts'] = 1;
		$options['trackbacks_pages'] = 0;
		$options['trackbacks_posts'] = 1;
		$options['author_box_single'] = 1;
		$options['breadcrumb_home'] = 1;
		$options['breadcrumb_single'] = 1;
		$options['breadcrumb_page'] = 1;
		$options['breadcrumb_archive'] = 1;
		$options['breadcrumb_404'] = 1;
		$options['content_archive'] = 'full';
		$options['content_archive_thumbnail'] = 0;
		$options['posts_nav'] = 'older-newer';
		$options['blog_cat'] = '';
		$options['blog_cat_exclude'] = '';
		$options['blog_cat_num'] = 10;
		$options['header_scripts'] = '';
		$options['footer_scripts'] = '';
		$options['theme_version'] = PARENT_THEME_VERSION;
		}
	return $options;
}

View available values for each option click here (a box will appear below listing each).

close

['update']  
     1 = Enable Automatic Updates, 
     0 = Off
['blog_title'] 
     text = Dynamic Text,  
     image = Image Logo
['header_right'] 
     1 = Widgetize Right Side of Header, 
     0 = no
['site_layout'] 
     content-sidebar,
     sidebar-content,
     content-sidebar-sidebar,
     sidebar-sidebar-content,
     sidebar-content-sidebar, 
     full-width-content
['nav'] 
     1 = Include Primary Navigation Menu,
     0 = No
['nav_superfish'] 
     1 = Enable Fancy Dropdowns,
     0 = Disable
['nav_home'] 
     1 = Display Home Link,
     0 = no
['nav_type'] 
     pages = List of Pages, 
     categories = List of Categories, 
     nav-menu = Custom Nav Menu
['nav_pages_sort'] 
     menu_order = Menu Order, 
     post_title = Title, 
     ID = ID, 
     post_date = Date Created,
     post_modified = Date Modified,
     post_author = Author, 
     post_name = Slug
['nav_categories_sort']
     menu_order = Menu Order, 
     post_title = Title, 
     ID = ID, 
     post_date = Date Created,
     post_modified = Date Modified,
     post_author = Author, 
     post_name = Slug
['nav_depth'] 
     0 = No Limit,
     1
     2
     3
     4
['nav_extras_enable'] 
     0 = Disabled,
     1 = Enable Extras on Right Side
['nav_extras'] 
     date,
     rss,
     search,
     twitter
['nav_extras_twitter_id'] = '',
['nav_extras_twitter_text'] = 'Follow me on Twitter',
['subnav']
     1 = Include Primary Navigation Menu,
     0 = No
['subnav_superfish']
     1 = Enable Fancy Dropdowns,
     0 = Disable
['subnav_home']
     1 = Display Home Link,
     0 = no
['subnav_type']
     pages = List of Pages, 
     categories = List of Categories, 
     nav-menu = Custom Nav Menu
['subnav_pages_sort']
     menu_order = Menu Order, 
     post_title = Title, 
     ID = ID, 
     post_date = Date Created,
     post_modified = Date Modified,
     post_author = Author, 
     post_name = Slug
['subnav_categories_sort']
     menu_order = Menu Order, 
     post_title = Title, 
     ID = ID, 
     post_date = Date Created,
     post_modified = Date Modified,
     post_author = Author, 
     post_name = Slug
['subnav_depth']
     0 = No Limit,
     1
     2
     3
     4
['feed_uri'] = '',
['comments_feed_uri'] = '',
['redirect_feeds']
     0 = Disable,
     1 = Enable
['comments_pages']
     0 = Disable,
     1 = Enable
['comments_posts']
     0 = Disable,
     1 = Enable
['trackbacks_pages']
     0 = Disable,
     1 = Enable
['trackbacks_posts']
     0 = Disable,
     1 = Enable
['author_box_single']
     0 = Disable,
     1 = Enable
['breadcrumb_home']
     0 = Disable,
     1 = Enable
['breadcrumb_single']
     0 = Disable,
     1 = Enable
['breadcrumb_page']
     0 = Disable,
     1 = Enable
['breadcrumb_archive']
     0 = Disable,
     1 = Enable
['breadcrumb_404']
     0 = Disable,
     1 = Enable
['content_archive']
     full = Display post content,
     excerpts = Display post excerpts
['content_archive_thumbnail']
     0 = Disable,
     1 = Enable
['posts_nav']
     older-newer,
     prev-next
     numeric
['blog_cat'] = '',
['blog_cat_exclude'] = '',
['blog_cat_num'] = 10,
['header_scripts'] = '',
['footer_scripts'] = '',
['theme_version'] = PARENT_THEME_VERSION

close

Remove Access to Genesis Admin Menu

remove_theme_support('genesis-admin-menu');

Removing per Post/Page Layout Options

This one comes in handing especially for theme designs where only one layout may seem fit.

remove_theme_support('genesis-inpost-layouts');

The code above should be placed in the child theme’s functions.php file anywhere after the following line:

require_once(TEMPLATEPATH.'/lib/init.php');

And before the following closing code (if it exists):

?>

About Christopher

Dabbler of anything web/tech/design/music. Independent web designer & developer.

Follow me on twitter @tweetsfromchris

Trackbacks

  1. Genesis Remove/Edit Default Admin Options says:
    July 16, 2012 at 10:10 am

    […] Thank You Genesis Tutorials /* About JonathanI've been creating websites for a very long time. I love the usability […]

Genesis Framework for WordPress

Subscribe to Blog via Email

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

Genesis Guide for Absolute Beginners

Click to download the Genesis Guide for Absolute Beginners

Follow me on Twitter

Follow @tweetsfromchris

Recent tutorials

Genesis 3.0.0 Removed Deprecated Functions

How to Add a Logo to the Header

Say Hello to the Genesis Visual Hook Guide v2.5

Genesis Tutorials • Built on the Genesis Theme Framework

Genesis Tutorials is not affiliated with StudioPress, and is maintained and operated by Christopher Cochran.