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 support for post formats.
*
*/
add_theme_support("post-formats", array("image", "quote", "video", "audio", "link", "gallery"));
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'primary-menu' => esc_html__( 'Primary', 'beauty-lab' ),
)
);
/*
* 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(
'beauty_lab_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// 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' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
/**
* Add support for woocommerce.
*
*/
add_theme_support( 'woocommerce' );
/**
* Add support for recnt post thumbnail image.
*
* @link https://developer.wordpress.org/reference/functions/add_image_size/
*/
add_image_size( 'beauty-lab-recent-post-thumbnail',98, 90, array('center', 'center') );
}
endif;
add_action( 'after_setup_theme', 'beauty_lab_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 beauty_lab_content_width() {
$GLOBALS['content_width'] = apply_filters( 'beauty_lab_content_width', 640 );
}
add_action( 'after_setup_theme', 'beauty_lab_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function beauty_lab_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'beauty-lab' ),
'id' => 'blog-sidebar',
'description' => esc_html__( 'Add widgets here.', 'beauty-lab' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Shop Sidebar', 'beauty-lab' ),
'id' => 'shop-sidebar',
'description' => esc_html__( 'Add widgets here.', 'beauty-lab' ),
'before_widget' => '',
'before_title' => '',
)
);
$footer_widget = get_theme_mod('bLab_footer_widget_column', 3);
for($i = 1; $i <= $footer_widget; $i++){
register_sidebar( array(
'name' => sprintf( __("Footer Widget %s", 'beauty-lab'), $i ),
'id' => 'footer_widget'.$i,
'description' => __('Footer widget content', 'beauty-lab'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
}
// register widget for custom rectent post
register_widget("Beauty_Lab_Widget_Recent_Posts");
}
add_action( 'widgets_init', 'beauty_lab_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function beauty_lab_scripts() {
//----enqueue css script-----
wp_enqueue_style('font', '//fonts.googleapis.com/css?family=Arimo:400,700|Roboto:300,300i,400,500,700,900', array(), _S_VERSION, 'all' );
wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font-awesome.min.css', array(), _S_VERSION, 'all' );
wp_enqueue_style('bootstrap', get_template_directory_uri().'/assets/css/bootstrap.min.css', array(), _S_VERSION, 'all' );
wp_enqueue_style('beauty-lab-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_enqueue_style('global-style', get_template_directory_uri().'/assets/css/global-style.css', array(), _S_VERSION, 'all' );
wp_enqueue_style('theme-style', get_template_directory_uri().'/assets/css/theme-style.css', array(), _S_VERSION, 'all' );
wp_enqueue_style('theme-color', get_template_directory_uri().'/assets/css/colors/color-1.css', array(), _S_VERSION, 'all' );
wp_enqueue_style('theme-responsive', get_template_directory_uri().'/assets/css/responsive.css', array(), _S_VERSION, 'all' );
wp_style_add_data( 'beauty-lab-style', 'rtl', 'replace' );
//----enqueue js script-----
wp_enqueue_script('jquery');
wp_enqueue_script('beauty-lab-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), _S_VERSION, true );
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), '4.1.3', true );
wp_enqueue_script('theme-main', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'beauty_lab_scripts' );
/**
* Enqueue styles for admin section
*/
function beauty_lab_admin_scripts(){
wp_enqueue_style( 'admin-styles', get_template_directory_uri() . '/assets/css/admin-style.css', array(), _S_VERSION, 'all' );
}
add_action( 'admin_enqueue_scripts', 'beauty_lab_admin_scripts' );
/**
* Bootstrap Navwalker
*/
require get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
/**
* Load customizer style
*
*/
require get_template_directory() . '/inc/customizer-style.php';
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Custom Widget Recen-post
*/
require get_template_directory() . '/inc/widgets/recent-posts.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
/**
* Load WooCommerce compatibility file.
*/
if ( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/woocommerce.php';
}