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

124 lines
2.2 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+
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
die;
}
add_action( 'genesis_setup', 'child_theme_add_textdomain' );
/**
* Add theme text domain.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_add_textdomain() {
$config = child_theme_get_config( 'textdomain' );
load_child_theme_textdomain( $config['domain'], $config['path'] );
}
add_action( 'genesis_setup', 'child_theme_add_theme_supports' );
/**
* Add theme supports.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_add_theme_supports() {
$config = child_theme_get_config( 'theme-supports' );
foreach ( $config as $feature => $args ) {
if ( is_array( $args ) ) {
add_theme_support( $feature, $args );
} else {
add_theme_support( $args );
}
}
}
add_action( 'genesis_setup', 'child_theme_add_image_sizes' );
/**
* Add new image sizes.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_add_image_sizes() {
$config = child_theme_get_config( 'image-sizes' );
foreach ( $config as $name => $args ) {
$crop = array_key_exists( 'crop', $args ) ? $args['crop'] : false;
add_image_size( $name, $args['width'], $args['height'], $crop );
}
}
add_action( 'genesis_setup', 'child_theme_add_post_type_supports' );
/**
* Add post type supports.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_add_post_type_supports() {
$config = child_theme_get_config( 'post-type-supports' );
foreach ( $config as $post_type => $support ) {
add_post_type_support( $post_type, $support );
}
}
add_action( 'genesis_setup', 'child_theme_add_default_headers' );
/**
* Add default header image.
*
* @since 1.0.0
*
* @return void
*/
function child_theme_add_default_headers() {
$config = child_theme_get_config( 'default-headers' );
register_default_headers( $config );
}