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 https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1568, 9999 );
add_image_size('front-page', 800, 600, array('center', 'center'));
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'menu-1' => __( 'Primary', 'atavist' ),
'footer' => __( 'Footer Menu', 'atavist' ),
'social' => __( 'Social Links Menu', 'atavist' ),
)
);
/*
* 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',
)
);
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 190,
'width' => 190,
'flex-width' => false,
'flex-height' => false,
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue editor styles.
add_editor_style( 'style-editor.css' );
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Small', 'atavist' ),
'shortName' => __( 'S', 'atavist' ),
'size' => 19.5,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'atavist' ),
'shortName' => __( 'M', 'atavist' ),
'size' => 22,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'atavist' ),
'shortName' => __( 'L', 'atavist' ),
'size' => 36.5,
'slug' => 'large',
),
array(
'name' => __( 'Huge', 'atavist' ),
'shortName' => __( 'XL', 'atavist' ),
'size' => 49.5,
'slug' => 'huge',
),
)
);
// Editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Primary', 'atavist' ),
'slug' => 'primary',
'color' => atavist_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ),
),
array(
'name' => __( 'Secondary', 'atavist' ),
'slug' => 'secondary',
'color' => atavist_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 23 ),
),
array(
'name' => __( 'Dark Gray', 'atavist' ),
'slug' => 'dark-gray',
'color' => '#111',
),
array(
'name' => __( 'Light Gray', 'atavist' ),
'slug' => 'light-gray',
'color' => '#767676',
),
array(
'name' => __( 'White', 'atavist' ),
'slug' => 'white',
'color' => '#FFF',
),
)
);
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
}
endif;
add_action( 'after_setup_theme', 'atavist_setup' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function atavist_widgets_init() {
register_sidebar(
array(
'name' => __( 'Sidebar 1', 'atavist' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your footer.', 'atavist' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => __( 'Footer 1', 'atavist' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your footer.', 'atavist' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer 2', 'atavist' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your footer.', 'atavist' ),
'before_widget' => '',
'before_title' => '',
)
);
}
add_action( 'widgets_init', 'atavist_widgets_init' );
/**
* Set 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 Content width.
*/
function atavist_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'atavist_content_width', 640 );
}
add_action( 'after_setup_theme', 'atavist_content_width', 0 );
/**
* Enqueue scripts and styles.
*/
function atavist_scripts() {
wp_enqueue_style( 'atavist-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) );
wp_style_add_data( 'atavist-style', 'rtl', 'replace' );
//wp_enqueue_style( 'atavist-rtl-style', get_template_directory_uri() . '/style-rtl.css', array(), wp_get_theme()->get( 'Version' ) );
wp_enqueue_script( 'atavist-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'atavist-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true );
wp_enqueue_script( 'atavist-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true );
}
wp_enqueue_style( 'atavist-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if(is_front_page()){
//wp_enqueue_script( 'atavist-cycle-slider', get_theme_file_uri( '/js/cycle2.js' ), array('jquery'), '1.0', true );
wp_enqueue_script( 'atavist-slider-pro', get_theme_file_uri( '/js/jquery.sliderPro.min.js' ), array('jquery'), '1.0', true );
wp_enqueue_style( 'atavist-sp-style', get_template_directory_uri() . '/init/assets/css/slider-pro.min.css', array(), wp_get_theme()->get( 'Version' ) );
}
}
add_action( 'wp_enqueue_scripts', 'atavist_scripts' );
/**
* Enqueue supplemental block editor styles.
*/
function atavist_editor_customizer_styles() {
wp_enqueue_style( 'atavist-editor-customizer-styles', get_theme_file_uri( '/style-editor-customizer.css' ), false, '1.0', 'all' );
if ( 'custom' === get_theme_mod( 'primary_color' ) ) {
// Include color patterns.
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
wp_add_inline_style( 'atavist-editor-customizer-styles', atavist_custom_colors_css() );
}
}
add_action( 'enqueue_block_editor_assets', 'atavist_editor_customizer_styles' );
/**
* Display custom color CSS in customizer and on frontend.
*/
function atavist_colors_css_wrap() {
// Only include custom colors in customizer or frontend.
if ( ( ! is_customize_preview() && 'default' === get_theme_mod( 'primary_color', 'default' ) ) || is_admin() ) {
return;
}
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
$primary_color = 199;
} else {
$primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
}
?>