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(
'main-menu' => esc_html__( 'Primary Menu', 'home-services' )
)
);
/*
* 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',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support('custom-background',
apply_filters(
'home_services_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
remove_theme_support( 'header_textcolor' );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 170,
'width' => 54,
'flex-width' => true,
'flex-height' => true,
)
);
add_editor_style( get_stylesheet_uri() );
}
endif;
add_action( 'after_setup_theme', 'home_services_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 home_services_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( 'home_services_content_width', 640 );
}
add_action( 'after_setup_theme', 'home_services_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function home_services_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Footer #1', 'home-services' ),
'id' => 'footer-widget',
'description' => esc_html__( 'Add widgets here.', 'home-services' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer #2', 'home-services' ),
'id' => 'footer-widget-2',
'description' => esc_html__( 'Add widgets here.', 'home-services' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer #3', 'home-services' ),
'id' => 'footer-widget-3',
'description' => esc_html__( 'Add widgets here.', 'home-services' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer #4', 'home-services' ),
'id' => 'footer-widget-4',
'description' => esc_html__( 'Add widgets here.', 'home-services' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar( array(
'name' => esc_html__( 'Main Sidebar', 'home-services' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
if(home_services_set_pro_active()){
register_sidebar( array(
'name' => esc_html__( 'Promotion Sidebar for List Page', 'home-services' ),
'id' => 'promotion-sidebar',
'description' => esc_html__( 'Add widgets here to display in promotion template sidebar', 'home-services' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Promotion Sidebar for single Page', 'home-services' ),
'id' => 'promotion-sidebar1',
'description' => esc_html__( 'Add widgets here to display in promotion single page sidebar', 'home-services' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Testimonial Sidebar', 'home-services' ),
'id' => 'testimonial-sidebar',
'description' => esc_html__( 'Add widgets here to display in testimonial template sidebar', 'home-services' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Team Sidebar for List Page', 'home-services' ),
'id' => 'team-sidebar',
'description' => esc_html__( 'Add widgets here to display in team template sidebar', 'home-services' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Team Sidebar for single Page', 'home-services' ),
'id' => 'team-sidebar1',
'description' => esc_html__( 'Add widgets here to display in team single page sidebar', 'home-services' ),
'before_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'home_services_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function home_services_scripts() {
$font_family = get_theme_mod( 'font_family', 'Quicksand' );
$heading_font_family = get_theme_mod( 'heading_font_family', 'Poppins' );
$site_identity_font_family = esc_attr( get_theme_mod( 'site_identity_font_family', 'Poppins' ) );
wp_enqueue_style( 'home-services-googlefonts', 'https://fonts.googleapis.com/css?family='. esc_attr( $font_family ) . ':200,300,400,500,600,700,800,900|' . esc_attr( $heading_font_family ) . ':200,300,400,500,600,700,800,900|' . esc_attr( $site_identity_font_family ) . ':200,300,400,500,600,700,800,900|' );
wp_enqueue_style( 'home-services-style', get_stylesheet_uri(), array(), HOME_SERVICES_VERSION );
wp_style_add_data( 'home-services-style', 'rtl', 'replace' );
wp_enqueue_style( 'all-fontawesome', get_template_directory_uri() . '/css/all.min.css', array(), HOME_SERVICES_VERSION );
wp_enqueue_style( 'owl-style', get_template_directory_uri() . '/css/owl.carousel.css', array(), HOME_SERVICES_VERSION );
wp_enqueue_script( 'all-fontawesome', get_template_directory_uri() . '/js/all.min.js', array(), HOME_SERVICES_VERSION, true );
wp_enqueue_script( 'owl-script', get_template_directory_uri() . '/js/owl.carousel.js', array(), HOME_SERVICES_VERSION, true );
wp_enqueue_script( 'isotope-pkgd', get_template_directory_uri() . '/js/isotope.pkgd.js', array(), HOME_SERVICES_VERSION, true );
wp_enqueue_script( 'home-services-script', get_template_directory_uri() . '/js/script.js', array(), HOME_SERVICES_VERSION, true );
wp_enqueue_script( 'home-services-navigation', get_template_directory_uri() . '/js/navigation.js', array(), HOME_SERVICES_VERSION, true );
wp_localize_script( 'home-services-ajax-js', 'home_services_ajax_params', array(
'ajaxurl' => esc_url_raw(admin_url( 'admin-ajax.php' ) ),
'nonce' => wp_create_nonce( 'nonce_name' )
) );
wp_enqueue_script( 'home-services-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), HOME_SERVICES_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'home_services_scripts' );
// add async and defer attributes to enqueued scripts
function home_services_script_loader_tag($tag, $handle, $src) {
if ($handle === 'all-fontawesome') {
if (false === stripos($tag, 'async')) {
$tag = str_replace(' src', ' async="async" src', $tag);
}
if (false === stripos($tag, 'defer')) {
$tag = str_replace('