/**
* Industro functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Industro
*/
if ( ! function_exists( 'industro_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 industro_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on _s, use a find and replace
* to change 'industro' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'industro', 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' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'industro' ),
'footer' => esc_html__( 'Footer Menu', 'industro' ),
) );
/*
* 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',
) );
// Load regular editor styles into the new block-based editor.
add_theme_support( 'editor-styles' );
// Load default block styles.
add_theme_support( 'wp-block-styles' );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
// Add image sizes
add_image_size( 'industro-post-thumbnail-shortcode', 658, 480, true );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, and column width.
*/
add_editor_style( array( 'css/editor-style.css', industro_fonts_url() ) );
}
endif;
add_action( 'after_setup_theme', 'industro_setup' );
/**
* 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
*/
function industro_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( 'industro_content_width', 640 );
}
add_action( 'after_setup_theme', 'industro_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function industro_widgets_init() {
/* Register the 'primary' sidebar. */
register_sidebar( array(
'name' => esc_html__( 'Primary Sidebar', 'industro' ),
'id' => 'primary',
'description' => esc_html__( 'Add widgets here.', 'industro' ),
'before_widget' => '',
'before_title' => '',
) );
/* Register the 'shop' sidebar. */
register_sidebar( array(
'name' => esc_html__( 'Product Sidebar', 'consultax' ),
'id' => 'product',
'description' => esc_html__( 'Add widgets here.', 'consultax' ),
'before_widget' => '',
'before_title' => '',
) );
/* Repeat register_sidebar() code for additional sidebars. */
register_sidebar( array(
'name' => __( 'Footer First Widget Area', 'industro' ),
'id' => 'footer-area-1',
'description' => __( 'Add widgets here to appear in your footer.', 'industro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Second Widget Area', 'industro' ),
'id' => 'footer-area-2',
'description' => __( 'Add widgets here to appear in your footer.', 'industro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Third Widget Area', 'industro' ),
'id' => 'footer-area-3',
'description' => __( 'Add widgets here to appear in your footer.', 'industro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Fourth Widget Area', 'industro' ),
'id' => 'footer-area-4',
'description' => __( 'Add widgets here to appear in your footer.', 'industro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'industro_widgets_init' );
/**
* Register custom fonts.
*/
if ( ! function_exists( 'industro_fonts_url' ) ) :
/**
* Register Google fonts for Blessing.
*
* Create your own industro_fonts_url() function to override in a child theme.
*
* @since Blessing 1.0
*
* @return string Google fonts URL for the theme.
*/
function industro_fonts_url() {
$fonts_url = '';
$font_families = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Roboto Slab, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'industro' ) ) {
$font_families[] = 'Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i';
}
if ( $font_families ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
endif;
/**
* Enqueue scripts and styles.
*/
function industro_scripts() {
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'industro-fonts', industro_fonts_url(), array(), null );
/** All frontend css files **/
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '3.3.7', 'all');
/** Load fonts **/
wp_enqueue_style( 'vc_font_awesome_5' );
wp_enqueue_style( 'flaticon-font', get_template_directory_uri().'/css/flaticon.css');
/** Slick slider **/
wp_enqueue_style( 'slick-slider', get_template_directory_uri().'/css/slick.css');
wp_enqueue_style( 'slick-theme', get_template_directory_uri().'/css/slick-theme.css');
/** Woocommerce **/
wp_enqueue_style( 'industro-woo', get_template_directory_uri().'/css/woocommerce.css');
if( industro_get_option('preload') != false ){
wp_enqueue_style( 'industro-preload', get_template_directory_uri().'/css/royal-preload.css');
}
/** Theme stylesheet. **/
wp_enqueue_style( 'industro-style', get_stylesheet_uri() );
if( industro_get_option('preload') != false ){
wp_enqueue_script("industro-royal-preloader", get_template_directory_uri()."/js/royal_preloader.min.js",array('jquery'), '1.0', false);
}
wp_enqueue_script( 'countto', get_template_directory_uri() . '/js/countto.js', array( 'jquery' ), '20180910', true );
wp_enqueue_script( 'slick', get_template_directory_uri() . '/js/slick.min.js', array( 'jquery' ), '20180910', true );
wp_enqueue_script( 'isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array( 'jquery' ), '20180910', true );
wp_enqueue_script( 'industro-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '20180910', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'industro_scripts' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/frontend/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/frontend/template-functions.php';
/**
* Custom breadcrumbs for this theme.
*/
require get_template_directory() . '/inc/frontend/breadcrumbs.php';
/**
* Functions which add more to backend.
*/
require get_template_directory() . '/inc/backend/admin-functions.php';
/**
* Custom metabox for this theme.
*/
require get_template_directory() . '/inc/backend/meta-boxes.php';
/**
* Register the required plugins for this theme.
*/
require get_template_directory() . '/inc/backend/plugin-requires.php';
/**
* Import Demo Content
*/
require_once get_template_directory() . '/inc/backend/importer.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/backend/customizer.php';
/**
* Color Scheme
*/
require_once get_template_directory() . '/inc/backend/color.php';
/**
* Custom shortcode plugin visual composer.
*/
require_once get_template_directory() . '/vc-shortcodes/shortcodes.php';
require_once get_template_directory() . '/vc-shortcodes/vc_shortcode.php';
/**
* Customizer Shop.
*/
require get_template_directory() . '/inc/frontend/woocommerce-customize.php';