Files
Thuan Bui fd25f13a4f Initial
2018-06-26 11:09:22 +07:00

57 lines
1.3 KiB
PHP

<?php
/**
* Child Theme Library
*
* WARNING: This file is a part of the core Child Theme Library.
* DO NOT edit this file under any circumstances. Please use
* the functions.php file to make any theme modifications.
*
* @package SEOThemes\ChildThemeLibrary\Functions
* @link https://github.com/seothemes/child-theme-library
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
add_filter( 'genesis_theme_settings_defaults', 'child_theme_set_default_settings' );
/**
* Update Theme Settings upon reset.
*
* @since 1.0.0
*
* @param array $defaults Default theme settings.
*
* @return array Custom theme settings.
*/
function child_theme_set_default_settings( array $defaults ) {
$config = child_theme_get_config( 'genesis-settings' );
$defaults = wp_parse_args( $config, $defaults );
return $defaults;
}
add_action( 'after_switch_theme', 'child_theme_update_settings' );
/**
* Update Theme Settings upon activation.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_update_settings() {
$config = child_theme_get_config();
if ( function_exists( 'genesis_update_settings' ) ) {
genesis_update_settings( $config['genesis-settings'] );
}
update_option( 'posts_per_page', $config['blog_cat_num'] );
}