get( 'Version' ) );
if( ! defined( 'BOUTIQUE_SHOP_THEME_NAME' ) ) define( 'BOUTIQUE_SHOP_THEME_NAME', $boutique_shop_theme_data->get( 'Name' ) );
if( ! defined( 'BOUTIQUE_SHOP_THEME_TEXTDOMAIN' ) ) define( 'BOUTIQUE_SHOP_THEME_TEXTDOMAIN', $boutique_shop_theme_data->get( 'TextDomain' ) );
if ( ! function_exists( 'boutique_shop_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 boutique_shop_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Boutique Shop, use a find and replace
* to change 'boutique-shop' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'boutique-shop', 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', 'boutique-shop' ),
) );
// Enable support for custom logo.
add_theme_support( 'custom-logo' , array(
'height' =>45,
'width' =>45,
'flex-height' =>true,
'flex-width' =>true,
));
/*
* 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',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'boutique_shop_custom_background_args', array(
'default-color' => 'fff',
'default-image' => '',
) ) );
// 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, icons, and column width.
*/
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
add_editor_style( array( '/assets/css/editor-style' . $min . '.css', boutique_shop_fonts_url() ) );
// Gutenberg support
add_theme_support( 'editor-color-palette', array(
array(
'name' => esc_html__( 'Tan', 'boutique-shop' ),
'slug' => 'tan',
'color' => '#E6DBAD',
),
array(
'name' => esc_html__( 'Yellow', 'boutique-shop' ),
'slug' => 'yellow',
'color' => '#FDE64B',
),
array(
'name' => esc_html__( 'Orange', 'boutique-shop' ),
'slug' => 'orange',
'color' => '#ED7014',
),
array(
'name' => esc_html__( 'Red', 'boutique-shop' ),
'slug' => 'red',
'color' => '#D0312D',
),
array(
'name' => esc_html__( 'Pink', 'boutique-shop' ),
'slug' => 'pink',
'color' => '#b565a7',
),
array(
'name' => esc_html__( 'Purple', 'boutique-shop' ),
'slug' => 'purple',
'color' => '#A32CC4',
),
array(
'name' => esc_html__( 'Blue', 'boutique-shop' ),
'slug' => 'blue',
'color' => '#3A43BA',
),
array(
'name' => esc_html__( 'Green', 'boutique-shop' ),
'slug' => 'green',
'color' => '#3BB143',
),
array(
'name' => esc_html__( 'Brown', 'boutique-shop' ),
'slug' => 'brown',
'color' => '#231709',
),
array(
'name' => esc_html__( 'Grey', 'boutique-shop' ),
'slug' => 'grey',
'color' => '#6C626D',
),
array(
'name' => esc_html__( 'Black', 'boutique-shop' ),
'slug' => 'black',
'color' => '#000000',
),
));
add_theme_support( 'align-wide' );
add_theme_support( 'editor-font-sizes', array(
array(
'name' => esc_html__( 'small', 'boutique-shop' ),
'shortName' => esc_html__( 'S', 'boutique-shop' ),
'size' => 12,
'slug' => 'small'
),
array(
'name' => esc_html__( 'regular', 'boutique-shop' ),
'shortName' => esc_html__( 'M', 'boutique-shop' ),
'size' => 16,
'slug' => 'regular'
),
array(
'name' => esc_html__( 'larger', 'boutique-shop' ),
'shortName' => esc_html__( 'L', 'boutique-shop' ),
'size' => 36,
'slug' => 'larger'
),
array(
'name' => esc_html__( 'huge', 'boutique-shop' ),
'shortName' => esc_html__( 'XL', 'boutique-shop' ),
'size' => 48,
'slug' => 'huge'
)
));
add_theme_support('editor-styles');
add_theme_support( 'wp-block-styles' );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'responsive-embeds' );
}
endif;
add_action( 'after_setup_theme', 'boutique_shop_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 boutique_shop_content_width() {
$GLOBALS['content_width'] = apply_filters( 'boutique_shop_content_width', 640 );
}
add_action( 'after_setup_theme', 'boutique_shop_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function boutique_shop_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar Option', 'boutique-shop' ),
'id' => 'right-sidebar',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Two', 'boutique-shop' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Three', 'boutique-shop' ),
'id' => 'sidebar-3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'boutique-shop' ),
'id' => 'footer-1',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'boutique-shop' ),
'id' => 'footer-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'boutique-shop' ),
'id' => 'footer-3',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 4', 'boutique-shop' ),
'id' => 'footer-4',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'boutique_shop_widgets_init' );
/**
* Register custom fonts.
*/
function boutique_shop_fonts_url() {
$boutique_shop_font_family = array(
'Kalam:wght@300;400;700',
'Vollkorn:ital,wght@0,400..900;1,400..900',
'Oswald:wght@200..700',
);
$boutique_shop_fonts_url = add_query_arg( array(
'family' => implode( '&family=', $boutique_shop_font_family ),
'display' => 'swap',
), 'https://fonts.googleapis.com/css2' );
$contents = wptt_get_webfont_url( esc_url_raw( $boutique_shop_fonts_url ) );
return $contents;
}
/**
* Enqueue scripts and styles.
*/
function boutique_shop_scripts() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$boutique_shop_fonts_url = boutique_shop_fonts_url();
$boutique_shop_primary_color = boutique_shop_get_option( 'primary_color' );
if ( ! empty( $boutique_shop_fonts_url ) ) {
wp_enqueue_style( 'boutique-shop-google-fonts', $boutique_shop_fonts_url, array(), null );
}
wp_enqueue_style( 'bootstrap-style', get_template_directory_uri().'/assets/css/bootstrap.css' );
wp_enqueue_style( 'fontawesome-all', get_template_directory_uri() . '/assets/css/all' . $min . '.css', '', '4.7.0' );
wp_enqueue_style( 'slick-theme-css', get_template_directory_uri() .'/assets/css/slick-theme' . $min . '.css', '', 'v2.2.0');
wp_enqueue_style( 'slick-css', get_template_directory_uri() .'/assets/css/slick' . $min . '.css', '', 'v1.8.0');
wp_enqueue_style( 'boutique-shop-blocks', get_template_directory_uri() . '/assets/css/blocks' . $min . '.css' );
wp_enqueue_style( 'boutique-shop-style', get_stylesheet_uri() );
wp_style_add_data('boutique-shop-style', 'rtl', 'replace');
require get_parent_theme_file_path( '/inc/css_custom.php' );
wp_add_inline_style( 'boutique-shop-style',$boutique_shop_custom_css );
wp_enqueue_script( 'jquery-slick', get_template_directory_uri() . '/assets/js/slick' . $min . '.js', array('jquery'), '2017417', true );
wp_enqueue_script( 'boutique-shop-navigation', get_template_directory_uri() . '/assets/js/navigation' . $min . '.js', array(), '20151215', true );
wp_enqueue_script( 'custom-js', get_template_directory_uri(). '/assets/js/custom.js', array('jquery') ,'',true);
wp_enqueue_script( 'boutique-shop-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix' . $min . '.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'boutique_shop_scripts' );
if( ! function_exists( 'boutique_shop_admin_scripts' ) ) :
/**
* Addmin scripts
*/
function boutique_shop_admin_scripts() {
wp_enqueue_style( 'boutique-shop-admin-style',get_template_directory_uri().'/assets/css/admin.css', BOUTIQUE_SHOP_THEME_VERSION, 'screen' );
}
endif;
add_action( 'admin_enqueue_scripts', 'boutique_shop_admin_scripts' );
/**
* Enqueue editor styles for Gutenberg
*
* @since Boutique Shop 1.0.0
*/
function boutique_shop_block_editor_styles() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
// Block styles.
wp_enqueue_style( 'boutique-shop-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks' . $min . '.css' ) );
// Add custom fonts.
wp_enqueue_style( 'boutique-shop-fonts', boutique_shop_fonts_url(), array(), null );
}
add_action( 'enqueue_block_editor_assets', 'boutique_shop_block_editor_styles' );
// Change number or products per row to 3
add_filter('loop_shop_columns', 'boutique_shop_loop_columns');
if (!function_exists('boutique_shop_loop_columns')) {
function boutique_shop_loop_columns() {
return 3; // 3 products per row
}
}
//Change number of products that are displayed per page (shop page)
add_filter( 'loop_shop_per_page', 'boutique_shop_products_per_page' );
function boutique_shop_products_per_page( $cols ) {
return 9;
}
function boutique_shop_template_setup() {
/**
* Load init.
*/
require_once get_template_directory() . '/inc/init.php';
/**
* Webfonts
*/
require get_template_directory() . '/inc/wptt-webfont-loader.php';
/**
* Getting Started
*/
require get_template_directory() . '/inc/getting-started/getting-started.php';
/**
* setup wizard
*/
require get_parent_theme_file_path( '/theme-wizard/config.php' );
/**
* Load plugin for right and no sidebar
*/
require get_template_directory() . '/inc/woocommerce-functions.php';
/**
* Pro Link.
*/
require_once get_template_directory() . '/inc/premium-link/class-button-link.php';
}
add_action('after_setup_theme', 'boutique_shop_template_setup');
/**
* Webfonts
*/
require get_template_directory() . '/inc/wptt-webfont-loader.php';
// range contol
function boutique_shop_sanitize_number_absint( $boutique_shop_number, $boutique_shop_setting ) {
// Ensure input is an absolute integer.
$boutique_shop_number = absint( $boutique_shop_number );
// Get the input attributes associated with the boutique_shop_setting.
$boutique_shop_atts = $boutique_shop_setting->manager->get_control( $boutique_shop_setting->id )->input_attrs;
// Get minimum number in the range.
$boutique_shop_min = ( isset( $boutique_shop_atts['min'] ) ? $boutique_shop_atts['min'] : $boutique_shop_number );
// Get maximum number in the range.
$boutique_shop_max = ( isset( $boutique_shop_atts['max'] ) ? $boutique_shop_atts['max'] : $boutique_shop_number );
// Get step.
$boutique_shop_step = ( isset( $boutique_shop_atts['step'] ) ? $boutique_shop_atts['step'] : 1 );
// If the number is within the valid range, return it; otherwise, return the default
return ( $boutique_shop_min <= $boutique_shop_number && $boutique_shop_number <= $boutique_shop_max && is_int( $boutique_shop_number / $boutique_shop_max ) ? $boutique_shop_number : $boutique_shop_setting->default );
}
function boutique_shop_sanitize_choicess($input) {
$valid = array(
'Arial' => 'Arial, sans-serif',
'Verdana' => 'Verdana, sans-serif',
'Helvetica' => 'Helvetica, sans-serif',
'Times New Roman'=> '"Times New Roman", serif',
'Georgia' => 'Georgia, serif',
'Courier New' => '"Courier New", monospace',
'Trebuchet MS' => '"Trebuchet MS", sans-serif',
'Tahoma' => 'Tahoma, sans-serif',
'Palatino' => '"Palatino Linotype", serif',
'Garamond' => 'Garamond, serif',
'Impact' => 'Impact, sans-serif',
'Comic Sans MS' => '"Comic Sans MS", cursive, sans-serif',
'Lucida Sans' => '"Lucida Sans Unicode", sans-serif',
'Arial Black' => '"Arial Black", sans-serif',
'Gill Sans' => '"Gill Sans", sans-serif',
'Segoe UI' => '"Segoe UI", sans-serif',
'Open Sans' => '"Open Sans", sans-serif',
'Roboto' => 'Roboto, sans-serif',
'Lato' => 'Lato, sans-serif',
'Montserrat' => 'Montserrat, sans-serif',
);
return (array_key_exists($input, $valid)) ? $input : '';
}
/**
* Set the number of products displayed per row on WooCommerce archive pages.
*
* @param int $columns Number of columns per row.
* @return int Number of columns to display per row.
*/
function boutique_shop_customize_woocommerce_archive_per_row($boutique_shop_columns) {
// Set the desired number of columns per row.
$boutique_shop_columns = boutique_shop_get_option( 'boutique_shop_archive_product_per_row' ); // You can change this to your preferred number.
return $boutique_shop_columns;
}
// Add a filter to modify the number of columns per row on WooCommerce archive pages.
add_filter('loop_shop_columns', 'boutique_shop_customize_woocommerce_archive_per_row');
/**
* Set the number of products displayed per page on WooCommerce archive pages.
*
* @param int $posts_per_page Number of products per page.
* @return int Number of products to display per page.
*/
function boutique_shop_customize_woocommerce_archive_per_page($boutique_shop_posts_per_page) {
// Set the desired number of products per page.
$boutique_shop_posts_per_page = boutique_shop_get_option( 'boutique_shop_archive_product_per_page' ); // You can change this to your preferred number.
return $boutique_shop_posts_per_page;
}
// Add a filter to modify the number of products displayed per page on WooCommerce archive pages.
add_filter('loop_shop_per_page', 'boutique_shop_customize_woocommerce_archive_per_page');
/**
* AJAX handler to dismiss Whizzie notice
*/
if ( ! function_exists( 'boutique_shop_dismiss_whizzie_notice' ) ) {
function boutique_shop_dismiss_whizzie_notice() {
update_user_meta(
get_current_user_id(),
'boutique_shop_whizzie_dismissed',
true
);
wp_die();
}
}
add_action(
'wp_ajax_boutique_shop_dismiss_whizzie_notice',
'boutique_shop_dismiss_whizzie_notice'
);
/**
* Check if Whizzie notice is dismissed
*/
if ( ! function_exists( 'boutique_shop_is_whizzie_dismissed' ) ) {
function boutique_shop_is_whizzie_dismissed() {
return (bool) get_user_meta(
get_current_user_id(),
'boutique_shop_whizzie_dismissed',
true
);
}
}
/**
* Reset Whizzie notice when theme is activated
*/
add_action( 'after_switch_theme', function () {
$users = get_users( array(
'fields' => 'ID',
) );
foreach ( $users as $user_id ) {
delete_user_meta( $user_id, 'boutique_shop_whizzie_dismissed' );
}
});
/**
* Display the admin notice unless dismissed.
*/
function boutique_shop_dashboard_notice() {
// Check if the notice is dismissed
$dismissed = get_user_meta( get_current_user_id(), 'boutique_shop_dismissable_notice', true );
// Display the notice only if not dismissed
if ( ! $dismissed ) {
// Get the theme name dynamically
$theme_name = wp_get_theme()->get( 'Name' );
?>
' . esc_html( $theme_name ) . ''
);
?>
get_control( $setting->id );
if ( array_key_exists( $input, $control->choices ) ) {
return $input;
} else {
return $setting->default;
}
}
function boutique_shop_sanitize_theme_width($input) {
// Define the valid options
$valid = array('full-width', 'container-fluid', 'container');
// Check if the input is in the array of valid options, otherwise return the default.
if (in_array($input, $valid, true)) {
return $input;
}
// Default fallback if the input is not valid.
return 'full-width';
}
function boutique_shop_menu_customizer_css() {
?>
'. esc_html( 'Comments are closed.', 'boutique-shop' ).'';
} elseif (is_search()) {
echo ''. esc_html( 'Search Result For.', 'boutique-shop' ).' ' . get_search_query() . '
';
} elseif (is_home() && !is_front_page()) {
echo ''. esc_html( 'Blogs', 'boutique-shop' ).'
';
} elseif (function_exists('is_shop') && is_shop()) {
echo ''. esc_html( 'Shop', 'boutique-shop' ).'
';
} elseif (is_page_template('template-homepage.php')) {
} elseif (is_page()) {
the_title('', '
');
} elseif (is_single()) {
the_title('', '
');
} elseif (is_archive()) {
the_archive_title('', '
');
} else {
the_archive_title('', '
');
}
}
function boutique_shop_custom_header_image() {
if (!is_front_page() || is_home()) {
echo '';
}
}
function boutique_shop_hide_single_header_img() {
?>
'',
'Verdana' => '',
'Helvetica' => '',
'Times New Roman'=> '',
'Georgia' => '',
'Courier New' => '',
'Trebuchet MS' => '',
'Tahoma' => '',
'Palatino' => '',
'Garamond' => '',
'Impact' => '',
'Comic Sans MS' => '',
'Lucida Sans' => '',
'Arial Black' => '',
'Gill Sans' => '',
'Segoe UI' => '',
'Open Sans' => 'Open+Sans:wght@400;700',
'Roboto' => 'Roboto:wght@400;700',
'Lato' => 'Lato:wght@400;700',
'Montserrat' => 'Montserrat:wght@400;700',
'Libre Baskerville' => 'Libre+Baskerville:wght@400;700'
);
$boutique_shop_google_fonts_url = '';
if (!empty($google_fonts[$boutique_shop_heading_font_family]) || !empty($google_fonts[$boutique_shop_body_font_family])) {
$fonts = array();
if (!empty($google_fonts[$boutique_shop_heading_font_family])) {
$fonts[] = $google_fonts[$boutique_shop_heading_font_family];
}
if (!empty($google_fonts[$boutique_shop_body_font_family])) {
$fonts[] = $google_fonts[$boutique_shop_body_font_family];
}
// Build Google Fonts URL
$boutique_shop_google_fonts_url = add_query_arg(
'family',
implode('|', $fonts),
'https://fonts.googleapis.com/css2'
);
}
if ($boutique_shop_google_fonts_url) {
wp_enqueue_style('boutique-shop', $boutique_shop_google_fonts_url, false);
}
}
add_action('wp_enqueue_scripts', 'boutique_shop_enqueue_google_fontss');
function boutique_shop_apply_typography() {
$boutique_shop_heading_font_family = get_theme_mod('boutique_shop_heading_font_family');
$boutique_shop_body_font_family = get_theme_mod('boutique_shop_body_font_family');
$boutique_shop_custom_css = '';
if ($boutique_shop_body_font_family) {
$boutique_shop_custom_css .= "body, a, a:active, a:hover { font-family: " . esc_html($boutique_shop_body_font_family) . " !important; }";
}
if ($boutique_shop_heading_font_family) {
$boutique_shop_custom_css .= "h1, h2, h3, h4, h5, h6 { font-family: " . esc_html($boutique_shop_heading_font_family) . " !important; }";
}
if (!empty($boutique_shop_custom_css)) {
wp_add_inline_style('boutique-shop-style', $boutique_shop_custom_css);
}
}
add_action('wp_enqueue_scripts', 'boutique_shop_apply_typography');