Re-add themes default options

This commit is contained in:
koenemann 2017-12-01 14:32:22 +01:00
parent ec3562fcd4
commit b95ee41617
2 changed files with 37 additions and 5 deletions

View File

@ -5,6 +5,11 @@
* @package understrap * @package understrap
*/ */
/**
* Initialize theme default settings
*/
require get_template_directory() . '/inc/theme-settings.php';
/** /**
* Theme setup and custom theme supports. * Theme setup and custom theme supports.
*/ */
@ -17,11 +22,6 @@ require get_template_directory() . '/inc/setup.php';
*/ */
require get_template_directory() . '/inc/widgets.php'; require get_template_directory() . '/inc/widgets.php';
/**
* Load functions to secure your WP install.
*/
// require get_template_directory() . '/inc/security.php';
/** /**
* Enqueue scripts and styles. * Enqueue scripts and styles.
*/ */

32
inc/theme-settings.php Executable file
View File

@ -0,0 +1,32 @@
<?php
/**
* Check and setup theme's default settings
*
* @package understrap
*
*/
if ( ! function_exists( 'understrap_setup_theme_default_settings' ) ) :
function understrap_setup_theme_default_settings() {
// check if settings are set, if not set defaults.
// Caution: DO NOT check existence using === always check with == .
// Latest blog posts style.
$understrap_posts_index_style = get_theme_mod( 'understrap_posts_index_style' );
if ( '' == $understrap_posts_index_style ) {
set_theme_mod( 'understrap_posts_index_style', 'default' );
}
// Sidebar position.
$understrap_sidebar_position = get_theme_mod( 'understrap_sidebar_position' );
if ( '' == $understrap_sidebar_position ) {
set_theme_mod( 'understrap_sidebar_position', 'right' );
}
// Container width.
$understrap_container_type = get_theme_mod( 'understrap_container_type' );
if ( '' == $understrap_container_type ) {
set_theme_mod( 'understrap_container_type', 'container' );
}
}
endif;