tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for custom logo.
*
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#custom-logo
*/
add_theme_support( 'custom-logo', array(
'height' => 120,
'width' => 488,
'flex-width' => true,
'flex-height' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/*
* Custom image sizes
*/
add_image_size( 'blogyy-featured-slider', 1300, 500, true );
add_image_size( 'blogyy-blog-thumb', 810, 466, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'blogyy' ),
) );
/*
* 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',
) );
//$primary_color = esc_attr( get_theme_mod( 'primary_color' ) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'blogyy_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support( 'woocommerce' );
}
endif; // blogyy_setup
add_action( 'after_setup_theme', 'blogyy_setup' );
/**
* Sets the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function blogyyblog_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blogyyblog_content_width', 840 );
}
add_action( 'after_setup_theme', 'blogyyblog_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function blogyy_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'blogyy' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer One', 'blogyy' ),
'id' => 'footer-one',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Two', 'blogyy' ),
'id' => 'footer-two',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Three', 'blogyy' ),
'id' => 'footer-three',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Four', 'blogyy' ),
'id' => 'footer-four',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'blogyy_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function blogyy_scripts() {
wp_enqueue_style( 'blogyy-fonts', blogyy_fonts_url(), array(), null );
wp_enqueue_style( 'blogyy-slick', get_template_directory_uri() . '/assets/css/slick.css', array());
wp_enqueue_style( 'blogyy-genericons', get_template_directory_uri() . '/assets/fonts/genericons/genericons.css', array(), '3.4.1' );
wp_enqueue_style( 'blogyy-style', get_stylesheet_uri() );
//We don't need to prefix owl-carousel to avoid duplicate load just like genericons.
wp_enqueue_script( 'blogyy-slick', get_template_directory_uri() . '/assets/js/slick.js', array('jquery'), true );
wp_enqueue_script( 'blogyy-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20161025', true );
wp_enqueue_script( 'blogyy-themejs', get_template_directory_uri() . '/assets/js/theme.js', array( 'jquery' ), '20161025', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( function_exists( 'blogyy_get_custom_style' ) ) {
wp_add_inline_style( 'blogyy-style', blogyy_get_custom_style() );
}
wp_localize_script( 'blogyy-themejs', 'screenReaderText', array(
'expand' => __( 'expand child menu', 'blogyy' ),
'collapse' => __( 'collapse child menu', 'blogyy' ),
) );
}
add_action( 'wp_enqueue_scripts', 'blogyy_scripts' );
if ( ! function_exists( 'blogyy_fonts_url' ) ) :
/**
* Register Google fonts.
* Create your own blogyy_fonts_url() function to override in a child theme.
*/
function blogyy_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'blogyy' ) ) {
$fonts[] = 'Open Sans:300,300i,400,400i,600,600i,700,700i';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* Date display functions
*
*/
if ( ! function_exists( 'blogyy_date_display' ) ) :
function blogyy_date_display( $format = 'l, F j, Y') {
echo esc_html( date_i18n( $format ,current_time( 'timestamp' ) ) );
}
endif;
/*
** Customizer Controls
*/
if (class_exists('WP_Customize_Control')) {
class blogyy_WP_Customize_Category_Control extends WP_Customize_Control {
/**
* Render the control's content.
*/
public function render_content() {
$dropdown = wp_dropdown_categories(
array(
'name' => '_customize-dropdown-categories-' . $this->id,
'echo' => 0,
'show_option_none' => __( '— Select —', 'blogyy' ),
'option_none_value' => '0',
'selected' => $this->value(),
)
);
$dropdown = str_replace( '