/**
* shale functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality.
*
* When using a child theme you can override certain functions (those wrapped
* in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before
* the parent theme's file, so the child theme functions would be used.
*
* @link https://codex.wordpress.org/Theme_Development
* @link https://codex.wordpress.org/Child_Themes
*
* Functions that are not pluggable (not wrapped in function_exists()) are
* instead attached to a filter or action hook.
*
* For more information on hooks, actions, and filters,
* {@link https://codex.wordpress.org/Plugin_API}
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since shale 1.0
*/
if ( ! isset( $content_width ) ) {
$content_width = 660;
}
if ( ! function_exists( 'shale_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*
* @since shale 1.0
*/
function shale_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*/
load_theme_textdomain( 'shale', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
// Add custom logo support
add_theme_support( 'custom-logo' );
// Add custom header support
$custom_header_args = array(
'flex-width' => true,
'width' => 1260,
'flex-height' => true,
'height' => 200,
'header-text' => false,
);
add_theme_support( 'custom-header', $custom_header_args );
// Add custom background support
add_theme_support( "custom-background" );
// Add new image sizes
add_image_size( 'shale-featured-image', 710, 470, array( 'left', 'center' ) );
// This theme uses wp_nav_menu() in one locations.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'shale' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
}
endif; // shale_setup
add_action( 'after_setup_theme', 'shale_setup' );
/**
* Register widget area.
*
* @since shale 1.0
*
* @link https://codex.wordpress.org/Function_Reference/register_sidebar
*/
function shale_widgets_init() {
register_sidebar( array(
'name' => __( 'Right Sidebar', 'shale' ),
'id' => 'sidebar-right',
'description' => __( 'Add widgets here to appear in your sidebar.', 'shale' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer', 'shale' ),
'id' => 'sidebar-footer',
'description' => __( 'Add widgets here to appear in your footer.', 'shale' ),
'before_widget' => '',
'before_title' => '