We’re all familiar with the Genesis settings section of the WordPress dashboard. It’s usually the first place we go when activating our child theme to make some basic changes such as switching to an image logo, setting breadcrumbs, or setting up our blog featured images and positions.
Did you know you can have Genesis set your preferred defaults every time you activate your theme for your projects? Take a quick look at the code at the bottom of the “theme-defaults.php” file in the Genesis Sample theme. Here, they’re using the genesis_update_settings
function to:
- Limit the number of posts displayed on the blog page template to 6
- Show the full content rather than excerpts in the content archives
- Limit content to 0 characters (a number here would only be applicable when using excerpts for the “content_archive” setting)
- Prevent the Featured Image from showing on archives
- Display numbered pagination rather than Previous/Next
- Setting the default site layout to be Content-Sidebar layout
Pretty cool huh?
But What About All the Other Genesis Settings?
You’ll quickly note that there are a lot more options that can be manipulated in the Genesis Theme Settings than just the 6 that are set as examples in the sample theme.
Check out the snippet below, here you’ll find all the settings and their associated options that you can use to completely control those options when activating your theme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Default settings and associated options for the Genesis Framework | |
* that can be set upon theme activation | |
*/ | |
add_action( 'after_switch_theme', 'lc_genesis_default_settings' ); | |
/** | |
* Update settings on theme switch (activation) | |
*/ | |
function lc_genesis_default_settings() { | |
if( ! function_exists( 'genesis_update_settings' ) ) | |
return; | |
$settings = array( | |
'update' => 0, // bool | |
'update_email_address' => '', // string (email) | |
'feed_uri' => '', // string (url) | |
'redirect_feed' => 0, // bool | |
'comments_feed_uri' => '', // string (url) | |
'redirect_comments_feed' => 0, // bool | |
'site_layout' => 'content-sidebar', // radio ( content-sidebar, sidebar-content, content-sidebar-sidebar, sidebar-sidebar-content, sidebar-content-sidebar, full-width-content ) | |
'blog_title' => 'text', // select ( text, image ) | |
'breadcrumb_front_page' => 0, // bool | |
'breadcrumb_posts_page' => 0, // bool | |
'breadcrumb_single' => 0, // bool | |
'breadcrumb_page' => 0, // bool | |
'breadcrumb_archive' => 0, // bool | |
'breadcrumb_404' => 0, // bool | |
'breadcrumb_attachment' => 0, // bool | |
'comments_posts' => 0, // bool | |
'comments_pages' => 0, // bool | |
'trackbacks_posts' => 0, // bool | |
'trackbacks_pages' => 0, // bool | |
'content_archive' => 'full', // select ( full, excerpts ) | |
'content_archive_limit' => '0', // int only applicable when using excerpts on content_archive | |
'content_archive_thumbnail' => 0, // bool | |
'image_size' => '', // select ( thumbnail, medium, large, full, etc. ) * dependent on the registered | |
// image sizes for your site | |
'image_alignment' => '', // select ( alignleft, alignright ) | |
'posts_nav' => '', // select ( prev-next, numberic ) | |
); | |
genesis_update_settings( $settings ); | |
} |
* I’ve intentionally left out the options for controlling the blog page template settings. There is a great article by Bill Erickson that gives the reasons for avoiding using the blog page template to show the blog on your site.
Leave a Reply