* Created on: 17/01/2019
*
* @package Slicko
*/
/* define( 'SLICKO_VERSION', '1.0' ); */
define( 'SLICKO_INC_DIR', trailingslashit( get_template_directory() ) . 'inc/' );
define( 'SLICKO_LIB_DIR', trailingslashit( get_template_directory() ) . 'lib/' );
define( 'SLICKO_ASSETS_URL', trailingslashit( get_template_directory_uri() ) . 'assets/' );
/**
* Slicko functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Slicko
*/
if ( ! function_exists( 'slicko_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.
*/
function slicko_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Slicko, use a find and replace
* to change 'slicko' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'slicko', 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.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'slicko-featured-thumb', 350, 230, true );
register_nav_menus(
array(
'main-menu' => esc_html__( 'Main Menu', 'slicko' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
'caption',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css', slicko_fonts_url() ) );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 180,
'width' => 40,
'flex-width' => true,
'flex-height' => true,
)
);
add_theme_support(
'custom-header',
array(
'flex-width' => true,
'width' => 1920,
'flex-height' => true,
'height' => 200,
'wp-head-callback' => 'slicko_header_style',
)
);
// add gutenberg color palette support.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'shark', 'slicko' ),
'slug' => 'shark',
'color' => '#202427',
),
array(
'name' => __( 'coral red', 'slicko' ),
'slug' => 'coral-red',
'color' => '#46DEB1',
),
array(
'name' => __( 'aztec', 'slicko' ),
'slug' => 'aztec',
'color' => '#22304A',
),
array(
'name' => __( 'very light gray', 'slicko' ),
'slug' => 'very-light-gray',
'color' => '#F8F8F8',
),
array(
'name' => __( 'dove gray', 'slicko' ),
'slug' => 'dove-gray',
'color' => '#666666',
),
array(
'name' => __( 'manatee', 'slicko' ),
'slug' => 'manatee',
'color' => '#9095A0',
),
)
);
// Default block styles.
add_theme_support( 'wp-block-styles' );
// Responsive embedded content.
add_theme_support( 'responsive-embeds' );
// add theme woocommerce support.
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
endif;
add_action( 'after_setup_theme', 'slicko_setup' );
if ( ! function_exists( 'slicko_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog.
*
* @since 1.0
*/
function slicko_header_style() {
$slicko_header_text_color = get_header_textcolor();
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
*/
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $slicko_header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let's do this.
?>
get( 'Version' ) );
}
add_action( 'enqueue_block_editor_assets', 'slicko_block_editor_styles' );
/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function slicko_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>