esc_url( get_home_url() ),
'styles_url' => esc_url( get_template_directory_uri() )
);
wp_localize_script( 'mino_local_js_object', 'mino_object', $translation_array );
// Enqueued script with localized data.
wp_enqueue_script( 'mino_local_js_object' );
// Check script debug enabled or not
if ( SCRIPT_DEBUG !== false ) {
/* Set additional CSS */
wp_enqueue_style( 'slick', MINO_THEME_URI_ASSETS . 'css/slick.css', array(), '20150112' );
/* Set additional JS */
wp_enqueue_script( 'slick', MINO_THEME_URI_ASSETS . 'js/slick.js', array( 'jquery' ), '1.5.9', true );
wp_enqueue_script( 'collapse', MINO_THEME_URI_ASSETS . 'js/collapse.js', array( 'jquery' ), '3.3.4', true );
wp_enqueue_script( 'transition', MINO_THEME_URI_ASSETS . 'js/transition.js', array( 'jquery' ), '3.3.4', true );
wp_enqueue_script( 'dropdown', MINO_THEME_URI_ASSETS . 'js/dropdown.js', array( 'jquery' ), '3.3.4', true );
wp_enqueue_script( 'imgliquid-min', MINO_THEME_URI_ASSETS . 'js/imgliquid-min.js', array(), '0.9.944', true );
} else {
/* Set default JS */
wp_enqueue_script( 'mino-script', MINO_THEME_URI_ASSETS . 'js/mino.min.js', array( 'jquery' ), '1.0', true );
}
/* Layout styles */
$theme_layout = 'wide';
if ( get_theme_mod( 'mino_theme_layout_customizer_set' ) == true ) {
$theme_layout = get_theme_mod( 'mino_theme_layout_customizer_set' );
}
wp_enqueue_style( 'mino-layout', MINO_THEME_URI_ASSETS . 'css/' . $theme_layout . '.css', array(), '1.0' );
/* Skin styles */
$theme_skin = 'black';
if ( get_theme_mod( 'mino_theme_color_customizer_set' ) == true ) {
$theme_skin = get_theme_mod( 'mino_theme_color_customizer_set' );
}
wp_enqueue_style( 'mino-skin', MINO_THEME_URI_ASSETS . 'css/skin/' . $theme_skin . '.css', array(), '1.0' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'keyboard-image-navigation', MINO_THEME_URI_ASSETS . 'js/keyboard-image-navigation.js', array( 'jquery' ), '20150112' );
}
/* Load the html5 shiv */
wp_enqueue_script( 'html5', MINO_THEME_URI_ASSETS . 'js/html5.js', array(), '3.7.3' );
wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );
}
}
add_action( 'wp_enqueue_scripts', 'mino_scripts' );
/**
* Set customizer CSS and JS
* @return -
*/
if ( ! function_exists( 'mino_customizer_scripts' ) ) {
function mino_customizer_scripts() {
wp_enqueue_style( 'mino_wp_admin_css', MINO_THEME_URI_ASSETS . '/admin/admin-style.css', false, '1.0.0' );
wp_enqueue_script( 'mino-customizer', MINO_THEME_URI_ASSETS . 'admin/customizer.js', array(), '1.0', true );
}
}
add_action( 'customize_controls_enqueue_scripts', 'mino_customizer_scripts' );
/**
* Add additional CSS and JS for post/page in admin page
* @return -
*/
if ( ! function_exists( 'mino_load_custom_wp_admin_scripts' ) ) {
function mino_load_custom_wp_admin_scripts() {
$screen = get_current_screen();
if ( $screen === false ) {
return;
}
if ( $screen->base == 'post' || $screen->base == 'appearance_page_mino-theme-premium' ) {
wp_enqueue_style( 'mino_wp_admin_css', MINO_THEME_URI_ASSETS . '/admin/admin-style.css', false, '1.0.0' );
wp_enqueue_script( 'mino_wp_admin_js', MINO_THEME_URI_ASSETS . '/admin/admin-script.js', array( 'jquery' ), '1.0', true );
}
}
}
add_action( 'admin_enqueue_scripts', 'mino_load_custom_wp_admin_scripts' );
/**
* Add layout stylesheet class
* @param array $classes Class name in array
* @return array New class name lists
*/
if ( ! function_exists( 'mino_add_theme_style' ) ) {
function mino_add_theme_style() {
$style_class = null;
if ( get_theme_mod( 'mino_theme_layout_customizer_set' ) == 'boxed' && get_theme_mod( 'mino_show_bg_pattern_set' ) == 1 && get_theme_mod( 'mino_bg_pattern_customizer_set' ) ) {
$style_class = '';
} else if ( get_theme_mod( 'mino_theme_layout_customizer_set' ) == 'boxed' && get_theme_mod( 'mino_show_bg_pattern_set', 0 ) == 1 ) {
$style_class = '';
}
echo apply_filters( 'mino_add_theme_style', $style_class );
}
}
add_action( 'wp_head', 'mino_add_theme_style' );
/**
* Show search form header
* @return -
*/
if ( ! function_exists( 'mino_search_form_header' ) ) {
function mino_search_form_header() {
$search_form_status = get_theme_mod( 'mino_search_form_customizer_set', 1 );
if ( $search_form_status ) {
$output = '
' . get_search_form( false ) . '
';
echo apply_filters( 'mino_search_output', $output );
}
}
}
add_action( 'mino_search_header', 'mino_search_form_header' );
/**
* Add meta box for Layout
* @param array $post_type List of post type
* @param object $post Post data
* @return - -
*/
if ( ! function_exists( 'mino_single_layout_box' ) ) {
function mino_single_layout_box( $post_type, $post ) {
$allowed_type = array(
'post', 'page'
);
if ( in_array( $post_type, $allowed_type ) ) {
add_meta_box(
'mino-layout-single',
__( 'Layout', 'mino' ),
'mino_single_layout_render',
null,
'normal',
'default'
);
}
}
}
add_action( 'add_meta_boxes', 'mino_single_layout_box', 10, 2 );
/**
* Render view for Layout fields box
* @param object $post Post data
* @return - -
*/
if ( ! function_exists( 'mino_single_layout_render' ) ) {
function mino_single_layout_render( $post ) {
wp_nonce_field( 'mino_single_layout_action', 'mino_single_layout_field' );
require_once ( MINO_THEME_DIR_INC . 'functions/view/layout-fields.php' );
}
}
/**
* Save Meta box data
* @param object $post Post data
* @return - -
*/
if ( ! function_exists( 'mino_single_custom_metabox' ) ) {
function mino_single_custom_metabox( $post_id ) {
/* Save Layout Data */
if ( isset( $_POST['mino_single_layout_field'] ) && wp_verify_nonce( $_POST['mino_single_layout_field'], 'mino_single_layout_action' ) ) {
if ( isset( $_POST['mino_custom_single_layout'] ) ) {
update_post_meta( $post_id, 'mino_custom_single_layout', sanitize_text_field( $_POST['mino_custom_single_layout'] ) );
}
}
}
}
add_action( 'save_post', 'mino_single_custom_metabox' );
/**
* Mino display header
* @return - -
*/
if ( ! function_exists( 'mino_set_display_header' ) ) {
function mino_set_display_header() {
$output_header = '';
/* Check has custom logo or not */
if ( function_exists( 'has_custom_logo' ) ) {
$has_custom_logo = has_custom_logo();
} else {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$has_custom_logo = (bool) $custom_logo_id;
}
if ( $has_custom_logo ) {
/* Get custom logo */
if ( function_exists( 'get_custom_logo' ) ) {
$output_header = get_custom_logo();
} else {
/* We have a logo. Logo is go. */
if ( $custom_logo_id ) {
$output_header = sprintf( '%2$s',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
'itemprop' => 'logo',
) )
);
/* Add href class */
if ( strpos( $output_header, 'class="custom-logo-link"' ) ) {
$output_header = str_replace( 'class="custom-logo-link"', 'class="custom-logo-link brand"', $output_header );
}
}
}
} else {
/* Header text color */
$header_text_color = get_header_textcolor();
$header_style = null;
if ( ! empty( $header_text_color ) ) {
$header_style = 'style="color:#' . $header_text_color . '"';
}
$header_open = '';
/* Header for single */
if ( is_single() || is_page() ) {
$header_open .= '';
$header_close = '
';
} else {
$header_open .= '';
$header_close = '
';
}
$blogname = get_bloginfo( 'name' );
$description = get_bloginfo( 'description' );
if ( ! empty( $description ) ) {
$description = '' . $description . '
';
}
$output_header = '' . $header_open . $blogname . $header_close . $description . '';
}
if ( ! empty( $output_header ) ) {
echo $output_header;
}
}
}
add_action( 'mino_display_header', 'mino_set_display_header' );
/**
* Set page cover for several page templates
* @return string Return slider image shortcode or default HTML
*/
if ( ! function_exists( 'mino_index_page_cover_frontend' ) ) {
function mino_index_page_cover_frontend() {
$id = get_the_ID();
$data = apply_filters( 'mino_condition_page_templates', array(
'page-templates/blog-homepage.php',
'page-templates/shop-homepage.php'
));
$page_template = get_post_meta( $id, '_wp_page_template', true );
/* Check page template */
if ( is_home() || strpos( $page_template, 'blog-homepage' ) ) {
/* Sticky */
if ( strpos( $page_template, 'shop-homepage' ) && in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
return false;
}
$sticky = get_option( 'sticky_posts' );
rsort( $sticky );
$sticky = array_slice( $sticky, 0, 1 );
if ( ! empty( $sticky ) ) {
$the_query = new WP_Query(
array(
'post__in' => $sticky,
'ignore_sticky_posts' => 1
)
);
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
$thumb_id = get_post_thumbnail_id( get_the_ID() );
$bg_image = wp_get_attachment_image_src( $thumb_id, 'mino-full-size' );
$bg_image = $bg_image[0];
$style = 'style="text-align: center !important; position: relative;"';
if ( $bg_image ) {
$style = 'style="background-image:url(' . $bg_image . '); background-repeat: no-repeat; background-size: cover; text-align: center !important; position: relative;"';
}
$html = '' . get_the_title() . '
' . get_the_excerpt() . '
';
$html = apply_filters( 'mino_shop_cover_html', $html );
echo $html;
endwhile;
endif;
wp_reset_postdata();
return false;
}
}
}
}
add_action( 'mino_index_page_cover', 'mino_index_page_cover_frontend' );
if ( ! function_exists( 'mino_exclude_sticky_home' ) ) {
/**
* Exlude sticky post from post list in home.php page
* @param object $query Query object
* @return -
*/
function mino_exclude_sticky_home( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
// Get sticky post id and exclude from list
$sticky_ids = get_option( 'sticky_posts' );
$query->set( 'post__not_in', $sticky_ids );
}
}
}
add_action( 'pre_get_posts', 'mino_exclude_sticky_home' );
/**
* Woocommerce filter part
*/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
/**
* Show image header
* @return -
*/
if ( ! function_exists( 'mino_show_account_menu' ) ) {
function mino_show_account_menu() {
global $woocommerce;
$cart_url = $woocommerce->cart->get_cart_url();
$page_account = esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) );
$account_list = array(
'my-account' => array(
'id' => 'my-account',
'slug' => $page_account,
'container_class' => '',
'anchor_class' => '',
'icon' => 'fa fa-user',
'icon_content' => '',
'label' => __( 'Dashboard', 'mino' )
),
'my-orders' => array(
'id' => 'my-orders',
'slug' => esc_url( wc_get_endpoint_url( 'orders' ) ),
'container_class' => '',
'anchor_class' => '',
'icon' => 'fa fa-list',
'icon_content' => '',
'label' => __( 'Recent Orders', 'mino' )
),
'my-dowloadable' => array(
'id' => 'my-downlaodable',
'slug' => esc_url( wc_get_endpoint_url( 'downloads' ) ),
'container_class' => '',
'anchor_class' => '',
'icon' => 'fa fa-download',
'icon_content' => '',
'label' => __( 'Downloadable', 'mino' )
),
'edit-account' => array(
'id' => 'edit-account',
'slug' => esc_url( wc_get_endpoint_url( 'edit-account' ) ),
'container_class' => '',
'anchor_class' => '',
'icon' => 'fa fa-pencil',
'icon_content' => '',
'label' => __( 'Edit Profile', 'mino' )
),
'edit-address' => array(
'id' => 'edit-address',
'slug' => array(
esc_url( wc_get_endpoint_url( 'edit-address' ) ),
esc_url( wc_get_endpoint_url( 'edit-address' ) ) . '/billing/',
esc_url( wc_get_endpoint_url( 'edit-address' ) ) . '/shipping/',
),
'container_class' => '',
'anchor_class' => '',
'icon' => 'fa fa-location-arrow',
'icon_content' => '',
'label' => __( 'Edit Address', 'mino' )
),
);
$account_list = apply_filters( 'mino_account_list_list', $account_list );
$account_menu = '';
if ( ! empty( $account_list ) ) {
$account_menu .= '';
$account_menu = apply_filters( 'mino_account_menu_list', $account_menu );
echo $account_menu;
}
}
}
add_action( 'mino_account_menu', 'mino_show_account_menu' );
/**
* Show search product form header
* @return -
*/
if ( ! function_exists( 'mino_search_product_header' ) ) {
function mino_search_product_form_header() {
$search_form_status = get_theme_mod( 'mino_search_form_customizer_set', 1 );
if ( $search_form_status ) {
$keyword = null;
if ( isset( $_GET['keyword'] ) ) {
$keyword = esc_attr( $_GET['keyword'] );
}
echo '' . get_search_form( false ) . '
';
}
}
}
add_action( 'mino_search_product_header', 'mino_search_product_form_header' );
/**
* Mino Woocommerce remove hook action
*/
/* Mino Woocommerce remove breadcrumb and add Mino breadcrumb hook */
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
add_action( 'woocommerce_before_main_content', 'mino_wc_dimox_breadcrumbs', 20, 0 );
/* Mino Woocommerce remove breadcrumb hook */
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20, 0);
/**
* Mino clear cart
* @return -
*/
if ( ! function_exists( 'mino_woocommerce_clear_cart' ) ) {
function mino_woocommerce_clear_cart() {
global $woocommerce;
if ( isset( $_REQUEST['clear_cart'] ) ) {
$woocommerce->cart->empty_cart();
}
}
}
add_action( 'init', 'mino_woocommerce_clear_cart' );
if ( function_exists( 'is_plugin_active' ) ) {
if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) ) {
if ( ! function_exists( 'mino_add_wishlist_button' ) ) {
function mino_add_wishlist_button() {
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
}
}
add_action( 'woocommerce_before_add_to_cart_button', 'mino_add_wishlist_button');
}
}
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
/**
* WooCommerce Loop Product Thumbs
**/
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
function woocommerce_template_loop_product_thumbnail() {
echo woocommerce_get_product_thumbnail();
}
}
/**
* WooCommerce Product Thumbnail
**/
if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0, $height = '320' ) {
global $post;
$image_wrapper = 'display: table-cell;';
if ( has_post_thumbnail() ) {
$image_wrapper = '';
}
$height = apply_filters( 'mino_woocommerce_featured_image_style', $height . 'px' );
$output = '';
if ( has_post_thumbnail() ) {
$output .= get_the_post_thumbnail( $post->ID, $size );
} else {
$output .= '
 .')
';
}
$output .= '
';
return $output;
}
}
add_action( 'mino_woocommerce_pagination', 'woocommerce_pagination' );
if ( ! function_exists( 'mino_woocommerce_recent_product_setup' ) ) {
function mino_woocommerce_recent_product_setup() {
global $post;
$label = apply_filters( 'mino_recent_product_label_store', get_theme_mod( 'mino_store_recent_product_label_customizer_set' ) );
echo '' . $label . '
';
$setup = array(
'container_class' => 'product-package-home col-md-3 col-sm-4 col-xs-6 nopad nopad-onmob',
'template_slug' => 'content',
'template_name' => 'product',
);
$setup = apply_filters( 'mino_woocommerce_recent_product_setup', $setup );
/* Set argument for recent product */
$args = array(
'post_type' => 'product',
'posts_per_page' => 8
);
$args = apply_filters( 'mino_woocommerce_recent_product_args', $args );
$latest_product = new WP_Query( $args );
echo '';
while ( $latest_product->have_posts() ) :
$latest_product->the_post();
echo '
';
wc_get_template_part( $setup['template_slug'], $setup['template_name'] );
echo '
';
endwhile;
echo '
';
wp_reset_postdata();
}
}
add_action( 'mino_woocommerce_recent_product', 'mino_woocommerce_recent_product_setup' );
if ( ! function_exists( 'mino_woocommerce_recent_category_setup' ) ) {
function mino_woocommerce_recent_category_setup() {
global $post;
$label = apply_filters( 'mino_popular_category_label_store', get_theme_mod( 'mino_store_popular_category_label_customizer_set' ) );
echo '' . $label . '
';
$taxonomies = array( 'product_cat' );
$taxonomies = apply_filters( 'mino_woocommerce_recent_category_taxonomies', $taxonomies );
$args = array(
'orderby' => 'count',
'order' => 'DESC',
'hide_empty' => true,
'number' => '3',
'fields' => 'all',
'pad_counts' => false,
);
$args = apply_filters( 'mino_woocommerce_recent_category_args', $args );
$terms = get_terms( $taxonomies, $args );
if ( ! empty( $terms ) ) :
foreach ( $terms as $term ) :
?>
' . $label . '
';
$setup = array(
'container_class' => 'col-md-4 col-sm-4'
);
$setup = apply_filters( 'mino_woocommerce_recent_posts_setup', $setup );
$args = array(
'posts_per_page' => 3,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => true,
);
$args = apply_filters( 'mino_woocommerce_recent_posts_args', $args );
$recent = new WP_Query( $args );
if ( $recent->have_posts() ) :
while ( $recent->have_posts() ) :
$recent->the_post();
?>
>
roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role ) {
$current_user = $role;
}
}
if ( $current_user == 'customer' ) {
echo '';
}
}
}
}
add_action( 'wp_header', 'mino_check_customer_logged_in' );
if ( ! function_exists( 'mino_before_woocommerce_page_container' ) ) {
/**
* Add additional content header before Woocommerce page
* @return -
*/
function mino_before_woocommerce_page_container() {
if ( is_account_page() ) {
echo '';
}
}
}
add_action( 'mino_before_woocommerce_page', 'mino_before_woocommerce_page_container' );
if ( ! function_exists( 'mino_after_woocommerce_page_container' ) ) {
/**
* Add additional content header after Woocommerce page
* @return -
*/
function mino_after_woocommerce_page_container() {
if ( is_account_page() ) {
echo '
';
}
}
}
add_action( 'mino_after_woocommerce_page', 'mino_before_woocommerce_page_container' );
}