$name, 'available' => $available, ); if ( ! tinv_get_option( 'integrations', $slug ) ) { return; } if ( ! $available ) { return; } add_action( 'after_setup_theme', 'tinvwl_flatsome' ); function tinvwl_flatsome() { if ( ! class_exists( 'Flatsome_Default' ) ) { return; } // Catalog mode if ( ! function_exists( 'tinvwl_flatsome_init' ) ) { /** * Run hooks after theme init. */ function tinvwl_flatsome_init() { if ( get_theme_mod( 'catalog_mode' ) ) { add_filter( 'tinvwl_allow_addtowishlist_single_product_summary', 'tinvwl_flatsome_woocommerce_catalog_mode', 10, 2 ); switch ( tinv_get_option( 'add_to_wishlist', 'position' ) ) { case 'before': add_action( 'woocommerce_single_variation', 'tinvwl_view_addto_html', 10 ); break; case 'after': add_action( 'woocommerce_single_variation', 'tinvwl_view_addto_html', 20 ); break; } add_action( 'woocommerce_single_variation', 'tinvwl_tinvwl_flatsome_woocommerce_catalog_mode_variable', 20 ); } } add_action( 'init', 'tinvwl_flatsome_init' ); } if ( ! function_exists( 'tinvwl_tinvwl_flatsome_woocommerce_catalog_mode_variable' ) ) { /** * Output variation hidden field. * */ function tinvwl_tinvwl_flatsome_woocommerce_catalog_mode_variable() { echo ''; } } if ( ! function_exists( 'tinvwl_flatsome_woocommerce_catalog_mode' ) ) { /** * Output wishlist button for Flatsome catalog mode * * @param bool $allow allow output. * * @return bool */ function tinvwl_flatsome_woocommerce_catalog_mode( $allow, $product ) { if ( ! $product->is_type( 'variable' ) ) { return true; } return $allow; } } // Header wishlist counter if ( ! function_exists( 'tinvwl_flatsome_header_wishlist' ) ) { /** * Header Wishlist element * * @param $elements * * @return mixed */ function tinvwl_flatsome_header_wishlist( $elements ) { $elements['wishlist'] = __( 'Wishlist', 'ti-woocommerce-wishlist' ); return $elements; } } add_filter( 'flatsome_header_element', 'tinvwl_flatsome_header_wishlist' ); if ( ! function_exists( 'tinvwl_flatsome_refresh_wishlist_partials' ) ) { function tinvwl_flatsome_refresh_wishlist_partials( WP_Customize_Manager $wp_customize ) { // Abort if selective refresh is not available. if ( ! isset( $wp_customize->selective_refresh ) ) { return; } $wp_customize->selective_refresh->add_partial( 'header-wishlist', array( 'selector' => '.header-wishlist-icon', 'container_inclusive' => true, 'settings' => array( 'wishlist_title', 'wishlist_icon', 'wishlist_title', 'wishlist_icon_style', 'header_wishlist_label' ), 'render_callback' => tinvwl_flatsome_render_header_wishlist(), ) ); } } add_action( 'customize_register', 'tinvwl_flatsome_refresh_wishlist_partials' ); $transport = 'postMessage'; if ( ! isset( $wp_customize->selective_refresh ) ) { $transport = 'refresh'; } $image_url = get_template_directory_uri() . '/inc/admin/customizer/img/'; Flatsome_Option::add_section( 'header_wishlist', array( 'title' => __( 'Wishlist', 'ti-woocommerce-wishlist' ), 'panel' => 'header', 'priority' => 110, ) ); Flatsome_Option::add_field( 'option', array( 'type' => 'select', 'settings' => 'wishlist_icon', 'label' => __( 'Wishlist Icon', 'ti-woocommerce-wishlist' ), 'transport' => $transport, 'section' => 'header_wishlist', 'default' => 'heart', 'choices' => array( '' => "None", "heart" => "Heart (Default)", "heart-o" => "Heart Outline", "star" => "Star", "star-o" => "Star Outline", "menu" => "List", "pen-alt-fill" => "Pen", ), ) ); Flatsome_Option::add_field( 'option', array( 'type' => 'radio-image', 'settings' => 'wishlist_icon_style', 'label' => __( 'Wishlist Icon Style', 'ti-woocommerce-wishlist' ), 'section' => 'header_wishlist', 'transport' => $transport, 'default' => '', 'choices' => array( '' => $image_url . 'icon-plain.svg', 'outline' => $image_url . 'icon-outline.svg', 'fill' => $image_url . 'icon-fill.svg', 'fill-round' => $image_url . 'icon-fill-round.svg', 'outline-round' => $image_url . 'icon-outline-round.svg', ), ) ); Flatsome_Option::add_field( 'option', array( 'type' => 'checkbox', 'settings' => 'wishlist_title', 'label' => __( 'Show Wishlist Title', 'ti-woocommerce-wishlist' ), //'description' => __( 'This is the control description', 'ti-woocommerce-wishlist' ), //'help' => __( 'This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'ti-woocommerce-wishlist' ), 'section' => 'header_wishlist', 'transport' => $transport, 'default' => 1, ) ); Flatsome_Option::add_field( 'option', array( 'type' => 'text', 'settings' => 'header_wishlist_label', 'label' => __( 'Custom Title', 'ti-woocommerce-wishlist' ), 'section' => 'header_wishlist', 'transport' => $transport, 'default' => '', ) ); function tinvwl_flatsome_render_header_wishlist() { $icon = get_theme_mod( 'wishlist_icon', flatsome_defaults( 'wishlist_icon' ) ); $icon_style = get_theme_mod( 'wishlist_icon_style', flatsome_defaults( 'wishlist_icon_style' ) ); ob_start(); ?>
  • get_counter(); if ( $counter > 0 ){ ?>data-icon-label="" >