/**
* Flash functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Flash
*/
if ( ! function_exists( 'flash_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 flash_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Flash, use a find and replace
* to change 'flash' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'flash', 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' );
/**
* Image size
*/
add_image_size( 'flash-square', '300', '300', true );
add_image_size( 'flash-big', '800', '400', true );
add_image_size( 'flash-grid', '370', '270', true );
/**
* Enable support for site Logo
*/
add_theme_support( 'custom-logo' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'flash' ),
'social' => esc_html__( 'Social', 'flash' ),
'footer' => esc_html__( 'Footer', 'flash' ),
) );
/*
* 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 woocommerce and woocommerce 3.0 product gallery
*/
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' );
/**
* Enable support for SiteOrigin Page Builder
*/
add_theme_support( 'siteorigin-panels', array(
'margin-bottom' => 0,
'recommended-widgets' => false,
) );
/**
* Enable Support for selective refresh widgets in Customizer
*/
add_theme_support( 'customize-selective-refresh-widgets' );
// Gutenberg layout support.
add_theme_support( 'align-wide' );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Responsive embeds support.
add_theme_support( 'responsive-embeds' );
}
endif;
add_action( 'after_setup_theme', 'flash_setup' );
/**
* Enqueue block editor styles.
*
* @since Flash 1.3.5
*/
function flash_block_editor_styles()
{
wp_enqueue_style('flash-editor-googlefonts', '//fonts.googleapis.com/css?family=Montserrat:400,700&display=swap');
wp_enqueue_style('flash-block-editor-styles', get_template_directory_uri() . '/style-editor-block.css');
}
add_action('enqueue_block_editor_assets', 'flash_block_editor_styles', 1, 1);
// Theme version.
$flash_theme = wp_get_theme();
define( 'FLASH_THEME_VERSION', $flash_theme->get( 'Version' ) );
if ( ! function_exists( 'flash_content_width' ) ) :
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* @global int $content_width
**/
function flash_content_width() {
$content_width = 780;
$classes = flash_get_layout();
if ( $classes == 'full-width' ) {
$content_width = 1200;
}
$GLOBALS['content_width'] = apply_filters( 'flash_content_width', $content_width );
}
add_action( 'after_setup_theme', 'flash_content_width', 0 );
endif;
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function flash_widgets_init() {
// Right Sidebar
register_sidebar( array(
'name' => esc_html__( 'Right Sidebar', 'flash' ),
'id' => 'flash_right_sidebar',
'description' => esc_html__( 'Add widgets here for right sidebar.', 'flash' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
// Left Sidebar
register_sidebar( array(
'name' => esc_html__( 'Left Sidebar', 'flash' ),
'id' => 'flash_left_sidebar',
'description' => esc_html__( 'Add widgets here for left sidebar.', 'flash' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '