Current File : /home/kelaby89/topflowroofingplumbing.com.au/wp-content/themes/homlane/functions.php |
<?php require_once get_template_directory() . '/includes/loader.php';
add_action( 'after_setup_theme', 'homlane_setup_theme' );
add_action( 'after_setup_theme', 'homlane_load_default_hooks' );
function homlane_setup_theme() {
load_theme_textdomain( 'homlane', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
add_theme_support( 'custom-header' );
add_theme_support( 'custom-background' );
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-lightbox');
/*
* 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_theme_support( 'automatic-feed-links' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'editor-styles' );
// Set the default content width.
$GLOBALS['content_width'] = 525;
/*---------- Register image sizes ----------*/
//Register image sizes
add_image_size( 'homlane_370x210', 370, 210, true ); //Services V1 & V2
add_image_size( 'homlane_370x226', 370, 226, true ); //TA What We Do V2
add_image_size( 'homlane_226x106', 226, 106, true ); //TA Oue Services V1
add_image_size( 'homlane_370x221', 370, 221, true ); //TA Oue Services V3
add_image_size( 'homlane_270x232', 270, 232, true ); //TA Oue Services V3
add_image_size( 'homlane_298x215', 298, 215, true ); //TA Oue Services V7
add_image_size( 'homlane_370x242', 370, 242, true ); //TA Our Features V2
add_image_size( 'homlane_370x328', 370, 328, true ); //TA Latest Projects V5
add_image_size( 'homlane_370x223', 370, 223, true ); //TA Latest Projects V5
add_image_size( 'homlane_370x300', 370, 300, true ); //TA Latest Projects V5
add_image_size( 'homlane_270x355', 270, 355, true ); //Latest Projects
add_image_size( 'homlane_270x340', 270, 340, true ); //TA Latest Projects
add_image_size( 'homlane_370x582', 370, 582, true ); //TA Latest Projects V2
add_image_size( 'homlane_770x280', 770, 280, true ); //TA Latest Projects V2
add_image_size( 'homlane_370x280', 370, 280, true ); //TA Latest Projects V2
add_image_size( 'homlane_407x392', 407, 392, true ); //TA Latest Projects V3
add_image_size( 'homlane_407x230', 407, 230, true ); //TA Latest Projects V8
add_image_size( 'homlane_407x230', 407, 230, true ); //TA Latest Projects V5
add_image_size( 'homlane_406x328', 406, 328, true ); //TA Latest Projects V5
add_image_size( 'homlane_406x245', 406, 245, true ); //TA Latest Projects V5
add_image_size( 'homlane_407x321', 407, 321, true ); //TA Latest Projects V8
add_image_size( 'homlane_407x295', 407, 295, true ); //TA Latest Projects V8
add_image_size( 'homlane_710x450', 710, 451, true ); //TA Latest Projects V4
add_image_size( 'homlane_370x240', 370, 240, true ); //TA Latest Projects V7
add_image_size( 'homlane_309x301', 309, 301, true ); //TA Latest Projects V9
add_image_size( 'homlane_632x609', 632, 609, true ); //TA Latest Projects V9
add_image_size( 'homlane_95x95', 95, 95, true ); //Testimonials V1 & V2
add_image_size( 'homlane_84x84', 84, 84, true ); //TA Testimonials V1
add_image_size( 'homlane_63x63', 63, 63, true ); //TA Testimonials V2
add_image_size( 'homlane_70x70', 70, 70, true ); //TA Testimonials V3
add_image_size( 'homlane_70x70', 72, 72, true ); //TA Testimonials V3
add_image_size( 'homlane_122x122', 122, 122, true ); //TA Testimonials V5
add_image_size( 'homlane_290x330', 290, 330, true ); //Team V1 & V2 & V3
add_image_size( 'homlane_270x360', 270, 360, true ); //TA Our Team
add_image_size( 'homlane_270x324', 270, 324, true ); //TA Our Team V2
add_image_size( 'homlane_293x333', 293, 333, true ); //TA Our Team V6
add_image_size( 'homlane_270x315', 270, 315, true ); //TA Our Team V7
add_image_size( 'homlane_270x324', 270, 324, true ); //TA Our Team V8
add_image_size( 'homlane_370x205', 370, 205, true ); //Latest News
add_image_size( 'homlane_570x320', 570, 320, true ); //Latest News
add_image_size( 'homlane_570x377', 570, 377, true ); //Latest News
add_image_size( 'homlane_200x130', 200, 130, true ); //Latest News
add_image_size( 'homlane_250x235', 250, 235, true ); //Latest News
add_image_size( 'homlane_370x230', 370, 230, true ); //TA Latest News V1
add_image_size( 'homlane_300x280', 300, 280, true ); //Projects V1
add_image_size( 'homlane_300x435', 300, 435, true ); //Projects V1
add_image_size( 'homlane_370x300', 370, 300, true ); //Projects V2
add_image_size( 'homlane_570x360', 570, 360, true ); //Blog Grid
add_image_size( 'homlane_407x221', 407, 221, true ); //Latest News V8
add_image_size( 'homlane_840x380', 840, 380, true ); //Blog With Sidebar & Single
add_image_size( 'homlane_70x60', 70, 60, true ); //Recent News Sidebar
add_image_size( 'homlane_430x422', 430, 422, true ); //Recent News Sidebar
add_image_size( 'homlane_370x361', 370, 361, true ); //Recent News Sidebar
/*---------- Register image sizes ends ----------*/
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'main_menu' => esc_html__( 'Main Menu', 'homlane' ),
'menu_onepage' => esc_html__( 'Menu OnePage', 'homlane' ),
) );
/*
* 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',
) );
// Add theme support for Custom Logo.
add_theme_support( 'custom-logo', array(
'width' => 250,
'height' => 250,
'flex-width' => true,
) );
// 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, and column width.
*/
add_editor_style();
add_action( 'admin_init', 'homlane_admin_init', 2000000 );
}
/**
* [homlane_admin_init]
*
* @param array $data [description]
*
* @return [type] [description]
*/
function homlane_admin_init() {
remove_action( 'admin_notices', array( 'ReduxFramework', '_admin_notices' ), 99 );
}
/*---------- Sidebar settings ----------*/
/**
* [homlane_widgets_init]
*
* @param array $data [description]
*
* @return [type] [description]
*/
function homlane_widgets_init() {
global $wp_registered_sidebars;
$theme_options = get_theme_mod( 'homlane' . '_options-mods' );
register_sidebar( array(
'name' => esc_html__( 'Default Sidebar', 'homlane' ),
'id' => 'default-sidebar',
'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'homlane' ),
'before_widget' => '<div id="%1$s" class="widget sidebar-widget single-sidebar %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="sidebar-title"><h5>',
'after_title' => '</h5></div>'
) );
register_sidebar(array(
'name' => esc_html__( 'Blog Listing', 'homlane' ),
'id' => 'blog-sidebar',
'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'homlane' ),
'before_widget'=>'<div id="%1$s" class="single-sidebar wow fadeInUp animated widget %2$s">',
'after_widget'=>'</div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '<span class="border-box"></span></h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget', 'homlane'),
'id' => 'footer-sidebar',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12"><div id="%1$s" class="single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
if ( class_exists( '\Elementor\Plugin' )){
register_sidebar(array(
'name' => esc_html__('Services Widget', 'homlane'),
'id' => 'services-sidebar',
'description' => esc_html__('Widgets in this area will be shown in Service Details Area.', 'homlane'),
'before_widget' => '<div id="%1$s" class="single-sidebar-style1 %2$s">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => ''
));
register_sidebar(array(
'name' => esc_html__('Footer Widget RTL', 'homlane'),
'id' => 'footer-sidebar-2',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xs-5th col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer__widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Three', 'homlane'),
'id' => 'footer-sidebar-3',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Four', 'homlane'),
'id' => 'footer-sidebar-4',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Five', 'homlane'),
'id' => 'footer-sidebar-5',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Six', 'homlane'),
'id' => 'footer-sidebar-6',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Seven', 'homlane'),
'id' => 'footer-sidebar-7',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Eight', 'homlane'),
'id' => 'footer-sidebar-8',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Nine', 'homlane'),
'id' => 'footer-sidebar-9',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Ten', 'homlane'),
'id' => 'footer-sidebar-10',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Eleven', 'homlane'),
'id' => 'footer-sidebar-11',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 footer-column"><div id="%1$s" class="footer-widget single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
register_sidebar(array(
'name' => esc_html__('Footer Widget Construction', 'homlane'),
'id' => 'footer-sidebar-12',
'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'homlane'),
'before_widget'=>'<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12"><div id="%1$s" class="single-footer-widget %2$s">',
'after_widget'=>'</div></div>',
'before_title' => '<div class="title"><h3>',
'after_title' => '</h3></div>'
));
}
if ( ! is_object( homlane_WSH() ) ) {
return;
}
$sidebars = homlane_set( $theme_options, 'custom_sidebar_name' );
foreach ( array_filter( (array) $sidebars ) as $sidebar ) {
if ( homlane_set( $sidebar, 'topcopy' ) ) {
continue;
}
$name = $sidebar;
if ( ! $name ) {
continue;
}
$slug = str_replace( ' ', '_', $name );
register_sidebar( array(
'name' => $name,
'id' => sanitize_title( $slug ),
'before_widget' => '<div id="%1$s" class="%2$s widget ">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title"><h4>',
'after_title' => '</h4></div>',
) );
}
update_option( 'wp_registered_sidebars', $wp_registered_sidebars );
}
add_action( 'widgets_init', 'homlane_widgets_init' );
/*---------- Sidebar settings ends ----------*/
/*---------- Gutenberg settings ----------*/
function homlane_gutenberg_editor_palette_styles() {
add_theme_support( 'editor-color-palette', array(
array(
'name' => esc_html__( 'strong yellow', 'homlane' ),
'slug' => 'strong-yellow',
'color' => '#f7bd00',
),
array(
'name' => esc_html__( 'strong white', 'homlane' ),
'slug' => 'strong-white',
'color' => '#fff',
),
array(
'name' => esc_html__( 'light black', 'homlane' ),
'slug' => 'light-black',
'color' => '#242424',
),
array(
'name' => esc_html__( 'very light gray', 'homlane' ),
'slug' => 'very-light-gray',
'color' => '#797979',
),
array(
'name' => esc_html__( 'very dark black', 'homlane' ),
'slug' => 'very-dark-black',
'color' => '#000000',
),
) );
add_theme_support( 'editor-font-sizes', array(
array(
'name' => esc_html__( 'Small', 'homlane' ),
'size' => 10,
'slug' => 'small'
),
array(
'name' => esc_html__( 'Normal', 'homlane' ),
'size' => 15,
'slug' => 'normal'
),
array(
'name' => esc_html__( 'Large', 'homlane' ),
'size' => 24,
'slug' => 'large'
),
array(
'name' => esc_html__( 'Huge', 'homlane' ),
'size' => 36,
'slug' => 'huge'
)
) );
}
add_action( 'after_setup_theme', 'homlane_gutenberg_editor_palette_styles' );
/*---------- Gutenberg settings ends ----------*/
/*---------- Enqueue Styles and Scripts ----------*/
function homlane_enqueue_scripts() {
//styles
wp_enqueue_style( 'aos', get_template_directory_uri() . '/assets/css/aos.css' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );
wp_enqueue_style( 'imp', get_template_directory_uri() . '/assets/css/imp.css' );
wp_enqueue_style( 'custom-animate', get_template_directory_uri() . '/assets/css/custom-animate.css' );
wp_enqueue_style( 'flaticon', get_template_directory_uri() . '/assets/css/flaticon.css' );
wp_enqueue_style( 'flaticon-2', get_template_directory_uri() . '/assets/css/flaticon-2.css' );
wp_enqueue_style( 'fontawesome-all', get_template_directory_uri() . '/assets/css/fontawesome-all.css' );
wp_enqueue_style( 'owl', get_template_directory_uri() . '/assets/css/owl.css' );
wp_enqueue_style( 'magnific-popup', get_template_directory_uri() . '/assets/css/magnific-popup.css' );
wp_enqueue_style( 'scrollbar', get_template_directory_uri() . '/assets/css/scrollbar.css' );
wp_enqueue_style( 'hiddenbar', get_template_directory_uri() . '/assets/css/hiddenbar.css' );
wp_enqueue_style( 'animate', get_template_directory_uri() . '/assets/css/animate.css' );
wp_enqueue_style( 'bootstrap-select', get_template_directory_uri() . '/assets/css/bootstrap-select.min.css' );
wp_enqueue_style( 'icomoon', get_template_directory_uri() . '/assets/css/icomoon.css' );
wp_enqueue_style( 'bootstrap-touchspin', get_template_directory_uri() . '/assets/css/jquery.bootstrap-touchspin.css' );
wp_enqueue_style( 'fancybox', get_template_directory_uri() . '/assets/css/jquery.fancybox.min.css' );
wp_enqueue_style( 'mCustomScrollbar', get_template_directory_uri() . '/assets/css/jquery.mCustomScrollbar.min.css' );
wp_enqueue_style( 'nouislider', get_template_directory_uri() . '/assets/css/nouislider.css' );
wp_enqueue_style( 'nouislider.pips', get_template_directory_uri() . '/assets/css/nouislider.pips.css' );
wp_enqueue_style( 'timePicker', get_template_directory_uri() . '/assets/css/timePicker.css' );
wp_enqueue_style( 'slick', get_template_directory_uri() . '/assets/css/slick.css' );
wp_enqueue_style( 'bxslider', get_template_directory_uri() . '/assets/css/jquery.bxslider.css' );
wp_enqueue_style( 'jquery-ui', get_template_directory_uri() . '/assets/css/jquery-ui.css' );
wp_enqueue_style( 'tinyscrollbar', get_template_directory_uri() . '/assets/css/tinyscrollbar.css' );
wp_enqueue_style( 'twentytwenty', get_template_directory_uri() . '/assets/css/twentytwenty.css' );
wp_enqueue_style( 'homlane-main', get_stylesheet_uri() );
wp_enqueue_style( 'homlane-color', get_template_directory_uri() . '/assets/css/color.css' );
wp_enqueue_style( 'homlane-color-2', get_template_directory_uri() . '/assets/css/color-2.css' );
wp_enqueue_style( 'homlane-theme-color', get_template_directory_uri() . '/assets/css/color/theme-color.css' );
wp_enqueue_style( 'homlane-rtl', get_template_directory_uri() . '/assets/css/rtl.css' );
wp_enqueue_style( 'homlane-main-style', get_template_directory_uri() . '/assets/css/style.css' );
wp_enqueue_style( 'homlane-main-style-2', get_template_directory_uri() . '/assets/css/style-2.css' );
wp_enqueue_style( 'homlane-custom', get_template_directory_uri() . '/assets/css/custom.css' );
wp_enqueue_style( 'homlane-responsive', get_template_directory_uri() . '/assets/css/responsive.css' );
//scripts
wp_enqueue_script( 'jquery-ui-core');
wp_enqueue_script( 'aos', get_template_directory_uri().'/assets/js/aos.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'appear', get_template_directory_uri().'/assets/js/appear.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'bootstrap-bundle', get_template_directory_uri().'/assets/js/bootstrap.bundle.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'bootstrap-select', get_template_directory_uri().'/assets/js/bootstrap-select.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'isotope', get_template_directory_uri().'/assets/js/isotope.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'bootstrap-touchspin', get_template_directory_uri().'/assets/js/jquery.bootstrap-touchspin.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'countdown', get_template_directory_uri().'/assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'countTo', get_template_directory_uri().'/assets/js/jquery.countTo.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'easing', get_template_directory_uri().'/assets/js/jquery.easing.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'enllax', get_template_directory_uri().'/assets/js/jquery.enllax.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'fancybox', get_template_directory_uri().'/assets/js/jquery.fancybox.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'mixitup', get_template_directory_uri().'/assets/js/jquery.mixitup.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'paroller', get_template_directory_uri().'/assets/js/jquery.paroller.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'nouislider', get_template_directory_uri().'/assets/js/nouislider.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'owl', get_template_directory_uri().'/assets/js/owl.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'jquery-twentytwenty', get_template_directory_uri().'/assets/js/jquery.twentytwenty.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'timePicker', get_template_directory_uri().'/assets/js/timePicker.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'wow', get_template_directory_uri().'/assets/js/wow.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'owl-vertical', get_template_directory_uri().'/assets/js/owl-vertical.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'validation', get_template_directory_uri().'/assets/js/validation.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'magnific-popup', get_template_directory_uri().'/assets/js/jquery.magnific-popup.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'slick', get_template_directory_uri().'/assets/js/slick.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'knob', get_template_directory_uri().'/assets/js/knob.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'lazyload', get_template_directory_uri().'/assets/js/lazyload.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'scrollbar', get_template_directory_uri().'/assets/js/scrollbar.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'tilt-jquery', get_template_directory_uri().'/assets/js/tilt.jquery.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'bxslider', get_template_directory_uri().'/assets/js/jquery.bxslider.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'jquery-ui', get_template_directory_uri().'/assets/js/jquery-ui.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'parallax', get_template_directory_uri().'/assets/js/parallax.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'tinyscrollbar', get_template_directory_uri().'/assets/js/jquery.tinyscrollbar.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'style-switcher', get_template_directory_uri().'/assets/js/jQuery.style.switcher.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'pagenav', get_template_directory_uri().'/assets/js/pagenav.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'tweenmax', get_template_directory_uri().'/assets/js/TweenMax.min.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'nav-tool', get_template_directory_uri().'/assets/js/nav-tool.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'dobpicker', get_template_directory_uri().'/assets/js/dobpicker.js', array( 'jquery' ), '2.1.2', true );
wp_enqueue_script( 'homlane-main-script', get_template_directory_uri().'/assets/js/custom.js', array(), false, true );
if( is_singular() ) wp_enqueue_script('comment-reply');
}
add_action( 'wp_enqueue_scripts', 'homlane_enqueue_scripts' );
/*---------- Enqueue styles and scripts ends ----------*/
/*---------- Google fonts ----------*/
function homlane_fonts_url() {
$fonts_url = '';
$font_families['Roboto'] = 'Roboto:ital,wght@0,300,0,400,0,500,0,700,0,900,1,300,1,400,1,500,1,700,1,900&display=swap';
$font_families['Barlow'] = 'Barlow:ital,wght@0,300,0,400,0,500,0,600,0,700,0,800,0,900,1,300,1,400,1,500,1,600,1,700,1,800,1,900&display=swap';
$font_families = apply_filters( 'HOMLANE/includes/classes/header_enqueue/font_families', $font_families );
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$protocol = is_ssl() ? 'https' : 'http';
$fonts_url = add_query_arg( $query_args, $protocol . '://fonts.googleapis.com/css' );
return esc_url_raw($fonts_url);
}
function homlane_theme_styles() {
wp_enqueue_style( 'homlane-theme-fonts', homlane_fonts_url(), array(), null );
}
add_action( 'wp_enqueue_scripts', 'homlane_theme_styles' );
add_action( 'admin_enqueue_scripts', 'homlane_theme_styles' );
/*---------- Google fonts ends ----------*/
/*---------- More functions ----------*/
// 1) homlane_set function
/**
* [homlane_set description]
*
* @param array $data [description]
*
* @return [type] [description]
*/
if ( ! function_exists( 'homlane_set' ) ) {
function homlane_set( $var, $key, $def = '' ) {
//if( ! $var ) return false;
if ( is_object( $var ) && isset( $var->$key ) ) {
return $var->$key;
} elseif ( is_array( $var ) && isset( $var[ $key ] ) ) {
return $var[ $key ];
} elseif ( $def ) {
return $def;
} else {
return false;
}
}
}
// 2) homlane_add_editor_styles function
function homlane_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'admin_init', 'homlane_add_editor_styles' );
// 3) Add specific CSS class by filter body class.
$options = homlane_WSH()->option();
if( homlane_set($options, 'boxed_wrapper') ){
add_filter( 'body_class', function( $classes ) {
$classes[] = 'boxed_wrapper';
return $classes;
} );
}
add_filter('doing_it_wrong_trigger_error', function () {return false;}, 10, 0);
/*---------- More functions ends ----------*/
function homlane_admin_style()
{
wp_enqueue_style('admin-styles', get_template_directory_uri().'/assets/css/admin.css');
wp_enqueue_media();
wp_enqueue_script('homlane-admin-scripts', get_template_directory_uri().'/assets/js/admin.js', array('jquery'), false, true);
wp_enqueue_script('homlane-upload-img', get_template_directory_uri() . '/assets/js/img_upload.js', array('jquery'), false, true);
}
add_action('admin_enqueue_scripts', 'homlane_admin_style');