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.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/**
* Allow to rewrite defined image sizes from child theme
*/
$default_image_sizes = array(
'post-thumbnail' => array(
'width' => 730,
'height' => 360,
'crop' => true
),
'slider-thumbnail' => array(
'width' => 1900,
'height' => 445,
'crop' => true
),
'related-thumbnail' => array(
'width' => 210,
'height' => 180,
'crop' => true
)
);
$image_sizes = wp_parse_args(
apply_filters( 'azeria_image_sizes', $default_image_sizes ),
$default_image_sizes
);
// default post thumbnail size
set_post_thumbnail_size(
$image_sizes['post-thumbnail']['width'],
$image_sizes['post-thumbnail']['height'],
$image_sizes['post-thumbnail']['crop']
);
// single slide thumbnail
add_image_size( 'azeria-slider-thumbnail',
$image_sizes['slider-thumbnail']['width'],
$image_sizes['slider-thumbnail']['height'],
$image_sizes['slider-thumbnail']['crop']
);
// related post thumbnail
add_image_size( 'azeria-related-thumbnail',
$image_sizes['related-thumbnail']['width'],
$image_sizes['related-thumbnail']['height'],
$image_sizes['related-thumbnail']['crop']
);
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'azeria' ),
) );
/*
* 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',
) );
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'image',
'gallery',
'video',
'quote',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'azeria_custom_background_args', array(
'default-color' => 'f3f3f3',
'default-image' => '',
) ) );
}
endif; // azeria_setup
add_action( 'after_setup_theme', 'azeria_setup' );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function azeria_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'azeria' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar Left', 'azeria' ),
'id' => 'footer-sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar Midlle', 'azeria' ),
'id' => 'footer-sidebar-2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar Right', 'azeria' ),
'id' => 'footer-sidebar-3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'azeria_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function azeria_assets() {
// Styles
wp_enqueue_style( 'azeria-fonts', azeria_fonts_url() );
wp_enqueue_style( 'azeria-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', false, '4.3.0' );
wp_enqueue_style( 'azeria-style', get_stylesheet_uri(), false, '1.0.0' );
// Scripts
wp_enqueue_script( 'azeria-slick-slider', get_template_directory_uri() . '/js/slick.js', array( 'jquery' ), '1.5.0', true );
wp_enqueue_script( 'azeria-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.js', array( 'jquery' ), '1.0.0', true );
wp_enqueue_script( 'azeria-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery', 'hoverIntent' ), '20120206', true );
wp_enqueue_script( 'azeria-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'azeria-custom-script', get_template_directory_uri() . '/js/script.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'azeria_assets' );
/**
* Get necessary Google fonts URL
*/
function azeria_fonts_url() {
$fonts_url = '';
$locale = get_locale();
$cyrillic_locales = array( 'ru_RU', 'mk_MK', 'ky_KY', 'bg_BG', 'sr_RS', 'uk', 'bel' );
/* Translators: If there are characters in your language that are not
* supported by Montserrat Alternates, translate this to 'off'. Do not translate
* into your own language.
*/
$montserrat = _x( 'on', 'Montserrat Alternates font: on or off', 'azeria' );
/* Translators: If there are characters in your language that are not
* supported by Open Sans Condensed, translate this to 'off'. Do not translate
* into your own language.
*/
$open_sans_condensed = _x( 'on', 'Open Sans Condensed font: on or off', 'azeria' );
/* 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.
*/
$open_sans = _x( 'on', 'Open Sans font: on or off', 'azeria' );
if ( 'off' == $montserrat && 'off' == $open_sans_condensed && 'off' == $open_sans ) {
return $fonts_url;
}
$font_families = array();
if ( 'off' !== $montserrat ) {
$font_families[] = 'Montserrat Alternates';
}
if ( 'off' !== $open_sans_condensed ) {
$font_families[] = 'Open Sans Condensed:300,700,300italic';
}
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open Sans:300,400,700,400italic,700italic';
}
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
if ( in_array($locale, $cyrillic_locales) ) {
$query_args['subset'] = urlencode( 'latin,latin-ext,cyrillic' );
}
$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
return $fonts_url;
}
/**
* Get theme option by name
*
* @param string $name option name
* @param mixed $default default option value
*/
function azeria_get_option( $name, $default = false ) {
$all_options = get_theme_mod( 'azeria' );
if ( is_array( $all_options ) && isset( $all_options[$name] ) ) {
return $all_options[$name];
}
return $default;
}
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Post format specific template tags.
*/
require get_template_directory() . '/inc/template-post-formats.php';
/**
* Functions hooked to custom theme actions.
*/
require get_template_directory() . '/inc/template-actions.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';