Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuadavidnelson/26af5c44e764b436038b to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/26af5c44e764b436038b to your computer and use it in GitHub Desktop.
Override and set Genesis Theme Options with php
<?php
/**
* Set Genesis Theme Options programatically
*
* @author Joshua David Nelson
*/
/**
* Information Metabox Options
*/
add_filter( 'genesis_pre_get_option_update', 'jdn_option_update', 11, 1 );
function jdn_option_update( $value ) {
$value = 1; // enable automatic updates with 1, disable with empty, false or 0
return $value;
}
add_filter( 'genesis_pre_get_option_update_email', 'jdn_option_update_email', 11, 1 );
function jdn_option_update_email( $value ) {
$value = 1; // if you want to email it set to 1, disable with empty, false or 0
return $value;
}
add_filter( 'genesis_pre_get_option_update_address', 'jdn_option_update_email_address', 11, 1 );
function jdn_option_update_email_address( $value ) {
$value = 'josh@joshuadnelson.com'; // set the email address to receive the notification
return $value;
}
/**
* Default Layout Option
*/
add_filter( 'genesis_pre_get_option_site_layout', 'jdn_option_site_layout', 11, 1 );
function jdn_option_site_layout( $value ) {
$value = 'content-sidebar'; // set default layout, default options: content-sidebar, sidebar-content, sidebar-sidebar-content, content-sidebar-sidebar, sidebar-content-sidebar, full-width-content
return $value;
}
/**
* Content Archive Settings
*/
add_filter( 'genesis_pre_get_option_content_archive', 'jdn_option_content_archive', 11, 1 );
function jdn_option_content_archive ( $value ) {
$value = 'excerpts'; // show excerpts
return $value;
}
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'jdn_option_content_archive_thumbnail', 11, 1 );
function jdn_option_content_archive_thumbnail ( $value ) {
$value = 1; // show thumbnail, set to false or 0 for opposite
return $value;
}
add_filter( 'genesis_pre_get_option_image_size', 'jdn_option_image_size', 11, 1 );
function jdn_option_image_size ( $value ) {
$value = 'thumbnail'; // set thumbnail size, only valid if _archive_thumbnail is set to 1
return $value;
}
add_filter( 'genesis_pre_get_option_image_alignment', 'jdn_option_content_archive', 11, 1 );
function jdn_option_image_alignment ( $value ) {
$value = ''; // 'none' option, also available: 'left' and 'right'
return $value;
}
add_filter( 'genesis_pre_get_option_posts_nav', 'jdn_option_posts_nav', 11, 1 );
function jdn_option_posts_nav ( $value ) {
$value = 'prev-next'; // showing pagination as 'prev-next', also available: 'numeric'
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment