/** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ function yit_tab_settings_settings( $items ) { unset( $items[20], $items[21], $items[22] ); if( is_shop_installed() ) { $items[40] = array( 'id' => 'product-seo-title', 'type' => 'text', 'name' => __( 'Products Title', 'yit' ), 'desc' => __( 'Type in the product title.', 'yit' ), 'std' => '' ); $items[41] = array( 'id' => 'product-seo-keywords', 'type' => 'text', 'name' => __( 'Products Keywords', 'yit' ), 'desc' => __( 'Type in the product keywords.', 'yit' ), 'std' => '' ); $items[42] = array( 'id' => 'product-seo-description', 'type' => 'text', 'name' => __( 'Products Description', 'yit' ), 'desc' => __( 'Type in the product description.', 'yit' ), 'std' => '' ); } return $items; }
function widget($args, $instance) { extract($args); echo $before_widget; $search_type = yit_get_option('search_type'); if (!is_shop_installed() && $search_type == 'product') { $search_type = 'post'; } ?> <form action="<?php echo home_url('/'); ?> " method="get" class="search_mini"> <input type="text" name="s" id="search_mini" value="<?php the_search_query(); ?> " placeholder="<?php if (is_shop_installed()) { _e('search for products', 'yit'); } else { _e('search for...', 'yit'); } ?> " /> <input type="hidden" name="post_type" value="<?php echo $search_type; ?> " /> <input type="submit" value="Search" id="mini-search-submit" /> </form> <?php echo $after_widget; }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { global $woocommerce; extract($args); if (!is_shop_installed() || yit_get_option('shop-enable') == 'no') { return; } ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list($cart_items, $cart_subtotal, $cart_icon, $cart_currency) = yit_get_current_cart_info(); ?> <a href="<?php echo WC()->cart->get_cart_url(); ?> " class="cart-items" style="background: url(<?php echo $cart_icon; ?> ) no-repeat center"> <span class="yit-mini-cart-icon"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> </span> </a> </div> <div class="cart_wrapper" style="display:none"> <div class="widget_shopping_cart_content group"> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e('No products in the cart.', 'yit'); ?> </li> </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($){ "use strict"; $(document).on('mouseover', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeIn(300); }).on('mouseleave', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeOut(300); }); $(document) .on('mouseenter', '.cart_wrapper', function(){ $(this).stop(true,true).show() }) .on('mouseleave', '.cart_wrapper', function(){ $(this).fadeOut(300) }); }); </script> </div> <?php }
/** * Unregister widgets * */ function yit_unregister_widgets($widgets) { $widgets = array_merge($widgets, array('WP_Widget_Recent_Comments', 'WP_Widget_Recent_Posts', 'last_post')); if (!is_shop_installed()) { $widgets[] = 'yit_featured_products'; } return $widgets; }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { global $woocommerce; extract($args); if (!is_shop_installed()) { return; } ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list($cart_items, $cart_subtotal, $cart_currency) = yit_get_current_cart_info(); ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?> " class="cart-items"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> <?php echo $cart_items != 1 ? __('', 'yit') : __(' ', 'yit'); ?> </a> </div> <div class="cart_wrapper" style="display:none"> <div class="widget_shopping_cart_content group"> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e('Товары не добавлены', 'yit'); ?> </li> </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($){ $(document).on('mouseover', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeIn(300); }).on('mouseleave', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeOut(300); }); $(document) .on('mouseenter', '.cart_wrapper', function(){ $(this).stop(true,true).show() }) .on('mouseleave', '.cart_wrapper', function(){ $(this).fadeOut(300) }); }); </script> </div> <?php }
function widget($args, $instance) { extract($args); echo $before_widget; $search_type = yit_get_option('search_type'); if (!is_shop_installed() && $search_type == 'product') { $search_type = 'post'; } ?> <a href="#" class="search_mini_button"></a> <div class="search_mini_content"> <span class="dropdown_arrow"></span> <?php if (defined('YITH_WCAS')) { ?> <?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?> <?php } else { ?> <form action="<?php echo home_url('/'); ?> " method="get" class="search_mini"> <input type="text" name="s" id="search_mini" value="<?php the_search_query(); ?> " placeholder="<?php if (is_shop_installed()) { _e('search for products', 'yit'); } else { _e('search for...', 'yit'); } ?> " /><input type="submit" value="" id="mini-search-submit" /> <input type="hidden" name="post_type" value="<?php echo $search_type; ?> " /> </form> <?php } ?> </div> <?php echo $after_widget; }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { global $woocommerce; extract( $args ); $active = (bool) !( empty( $_REQUEST['add-to-cart'] ) || ! is_numeric( $_REQUEST['add-to-cart'] ) ); /* fix yith catalog mode */ $ywctm_hide_cart_page = false; global $YITH_WC_Catalog_Mode; if ( isset( $YITH_WC_Catalog_Mode ) ) { $ywctm_hide_cart_page = method_exists( $YITH_WC_Catalog_Mode, 'check_hide_cart_checkout_pages' ) && $YITH_WC_Catalog_Mode->check_hide_cart_checkout_pages(); } if( !is_shop_installed() || yit_get_option('shop-enable' ) == 'no' || ! function_exists('yit_get_current_cart_info') || $ywctm_hide_cart_page) return; ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list( $cart_items, $cart_icon, $cart_icon_dark ) = yit_get_current_cart_info(); ?> <a href="<?php echo WC()->cart->get_cart_url(); ?>" class="cart-items" > <span class="yit-mini-cart-icon" > <span class="cart-items-number"><?php echo $cart_items ?></span> </span> <span class="yit-mini-cart-background no-dark" style="background-image: url(<?php echo $cart_icon ?>)"></span> <span class="yit-mini-cart-background only-dark" style="background-image: url(<?php echo $cart_icon_dark ?>)"></span> </a> </div> <div class="cart_wrapper <?php echo $active ? ' active' : ''; ?>" style="display:<?php echo $active ? 'block' : 'none'; ?>"> <div class="widget_shopping_cart_content group"> <?php if ( $active ) : ?> <div class="blockUI blockOverlay" style="z-index: 1000; border: none; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; cursor: none; position: absolute; opacity: 1; background: url(<?php echo YIT_THEME_ASSETS_URL ?>/images/search.gif) 50% 50% no-repeat rgb(255, 255, 255);"></div> <div class="blockUI blockMsg blockElement" style="z-index: 1011; display: none; position: absolute; left: 129px; top: 239px;"></div> <?php else : ?> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e( 'No products in the cart.', 'yit' ); ?></li> </ul> <?php endif; ?> </div> </div> </div> <?php }
function widget($args, $instance) { extract($args); echo $before_widget; $search_for_product = apply_filters('yit_search_for_prod_label', __('search for products', 'yit')); $search_for = apply_filters('yit_searc_for_prod_label', __('search for...', 'yit')); $placeholder = is_shop_installed() ? $search_for_product : $search_for; if (defined('YITH_WCAS')) { ?> <?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?> <?php } else { $search_type = yit_get_option('search_type'); if (!is_shop_installed() && $search_type == 'product') { $search_type = 'post'; } ?> <form action="<?php echo home_url('/'); ?> " method="get" class="search_mini"> <input type="text" name="s" id="search_mini" value="<?php the_search_query(); ?> " placeholder="<?php echo $placeholder; ?> " /> <input type="hidden" name="post_type" value="<?php echo $search_type; ?> " /> <input type="submit" value="<?php _e('Search', 'yit'); ?> " id="mini-search-submit" /> </form> <?php } echo $after_widget; }
echo esc_attr(yit_curPageURL()); ?> "/> <?php if ($do_ajax == 1) { ?> <input type="hidden" name="yit_ajax" class="yit_ajax" value="<?php echo esc_attr($do_ajax); ?> " data-action="yit_contact_form_submit"/> <?php } ?> <?php if (function_exists('WC') && is_shop_installed() && is_product()) { ?> <input type="hidden" name="yit_contact[sku]" value="<?php echo $GLOBALS['product']->sku; ?> "/> <input type="hidden" name="yit_contact[product_id]" value="<?php echo $GLOBALS['product']->id; ?> "/> <?php } ?> <input type="hidden" name="id_form" value="<?php echo $post_id; ?>
/** * Add specific fields to the tab General -> Settings * * @param array $fields * @return array */ function yit_tab_sidebars_sidebars_manager_shop_sidebar($fields) { if (!is_shop_installed()) { return $fields; } $fields[25] = array('id' => 'shop-sidebar', 'type' => 'customsidebar', 'name' => __('Shop Sidebar', 'yit'), 'desc' => __('Choose if you want to show a sidebar in Shop pages and where.', 'yit'), 'std' => apply_filters('yit_shop-sidebar_std', array('layout' => 'sidebar-left', 'sidebar' => 'Shop Sidebar')), 'deps' => array('ids' => 'enable-all-custom-sidebar', 'values' => 0)); $fields[26] = array('id' => 'single-shop-sidebar', 'type' => 'customsidebar', 'name' => __('Products Detail Sidebar', 'yit'), 'desc' => __('Choose if you want to show a sidebar in products detail pages and where.', 'yit'), 'std' => apply_filters('yit_single-shop-sidebar_std', array('layout' => 'sidebar-no', 'sidebar' => 'Shop Sidebar')), 'deps' => array('ids' => 'enable-all-custom-sidebar', 'values' => 0)); return $fields; }
} } //$sitemap['posts'] .= '</div>'; wp_reset_query(); } //get archives if (in_array('archives', $order)) { //$sitemap['archives'] = '<div class="sitemap-archives-container span3">'; $sitemap['archives'] = '<h3>' . yit_get_option('sitemap-archive-title') . '</h3>'; $sitemap['archives'] .= '<ul>'; $sitemap['archives'] .= wp_get_archives(array('type' => yit_get_option('sitemap-archive-type'), 'limit' => yit_get_option('sitemap-archive-limit') == -1 ? '' : yit_get_option('sitemap-archive-limit'), 'show_post_count' => yit_get_option('sitemap-archive-show_post_count'), 'echo' => 0)); $sitemap['archives'] .= '</ul>'; //$sitemap['archives'] .= '</div>'; } //get products if (in_array('products', $order) && is_shop_installed()) { $categories = get_terms('product_cat', array('hide_empty' => 0)); //$sitemap['products'] = '<div class="sitemap-products-container span3">'; $sitemap['products'] = '<h3>' . yit_get_option('sitemap-products-title') . '</h3>'; foreach ($categories as $category) { //get posts in category $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => yit_get_option('sitemap-products-number'), 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category->slug)), 'field' => 'slug', 'operator' => 'IN'))); $products = new WP_Query($args); if (count($products->posts) > 0) { $category_link = get_term_link($category, 'product_cat'); $sitemap['products'] .= '<h5><a href="' . $category_link . '">' . $category->name . '</a></h5>'; $sitemap['products'] .= '<ul class="cat_' . $category->term_id . ' cat">'; foreach ($products->posts as $post) { $sitemap['products'] .= '<li><a href="' . get_permalink($post->ID) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'yit'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title($post->ID) . '</a></li>'; } if (yit_get_option('sitemap-products-number') != -1) {
/** * Set up all theme data. * * @return void * @since 1.0.0 */ function yit_setup_theme() { /** * Set up the content width value based on the theme's design. * * @see yit_content_width() * * @since Twenty Fourteen 1.0 */ if (!isset($GLOBALS['content_width'])) { $GLOBALS['content_width'] = apply_filters('yit-container-width-std', 1170); } //This theme have a CSS file for the editor TinyMCE add_editor_style('css/editor-style.css'); //This theme support post thumbnails add_theme_support('post-thumbnails'); //This theme uses the menus add_theme_support('menus'); //Add default posts and comments RSS feed links to head add_theme_support('automatic-feed-links'); //This theme support post formats add_theme_support('post-formats', apply_filters('yit_post_formats_support', array('gallery', 'audio', 'video', 'quote'))); if (!defined('HEADER_TEXTCOLOR')) { define('HEADER_TEXTCOLOR', ''); } // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values. define('HEADER_IMAGE_WIDTH', apply_filters('yiw_header_image_width', 1170)); define('HEADER_IMAGE_HEIGHT', apply_filters('yiw_header_image_height', 410)); // Don't support text inside the header image. if (!defined('NO_HEADER_TEXT')) { define('NO_HEADER_TEXT', true); } //This theme support custom header add_theme_support('custom-header'); //This theme support custom backgrounds add_theme_support('custom-backgrounds'); /* * 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')); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be 940 pixels wide by 198 pixels tall. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. // set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); $image_sizes = array('blog_small' => array(368, 266, true), 'blog_single_small' => array(1140, 491, true), 'blog_masonry' => array(380, 999), 'blog_big' => array(1140, 265, true), 'blog_single_big' => array(1920, 443, true), 'blog_thumb' => array(49, 49, true), 'blog_section' => array(269, 122, true), 'blog_section_mobile' => array(716, 325, true), 'portfolio_filterable' => array(360, 392, true), 'portfolio_section' => array(380, 414, true), 'portfolio_pinterest' => 360, 'portfolio_single_big' => array(1920, 596, true), 'portfolio_single_small' => array(680, 494, true), 'portfolio_single_big_placeholder' => array(1920, 362, true), 'thumb-testimonial' => array(255, 255, true)); $image_sizes = apply_filters('yit_add_image_size', $image_sizes); foreach ($image_sizes as $id_size => $size) { add_image_size($id_size, apply_filters('yit_' . $id_size . '_width', $size[0]), apply_filters('yit_' . $id_size . '_height', $size[1]), isset($size[2]) ? $size[2] : false); } //Set localization and load language file $locale = get_locale(); $locale_file = YIT_THEME_PATH . "/languages/{$locale}.php"; if (is_readable($locale_file)) { require_once $locale_file; } //remove wpml stylesheet define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true); if (!defined('WPLANG')) { define('WPLANG', ''); } if (WPLANG != '') { load_theme_textdomain('yit', dirname(locate_template('/languages/' . WPLANG . '.mo'))); } else { load_theme_textdomain('yit', get_template_directory() . '/languages'); } // Add support to woocommerce if (defined('YIT_IS_SHOP') && YIT_IS_SHOP) { add_theme_support('woocommerce'); } //Register menus register_nav_menus(array('nav' => __('Main Navigation', 'yit'), 'mobile-nav' => __('Mobile Navigation', 'yit'), 'welcome-menu' => __('Welcome Menu', 'yit'), 'copyright_right' => __('Copyright Right', 'yit'), 'copyright_left' => __('Copyright Left', 'yit'), 'copyright_centered' => __('Copyright Centered', 'yit'))); //create the menu items if they don't exist $menuname = 'Welcome Menu'; if (!wp_get_nav_menu_object($menuname)) { if (is_shop_installed()) { $my_account_id = get_option('woocommerce_myaccount_page_id'); if ($my_account_id) { /* Assing my-account.php template to my-account page */ update_post_meta($my_account_id, '_wp_page_template', 'my-account.php'); $menu_id = wp_create_nav_menu($menuname); $my_account_url = get_permalink(wc_get_page_id('myaccount')); wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Account', 'yit'), 'menu-item-object' => 'page', 'menu-item-object-id' => get_option('woocommerce_myaccount_page_id'), 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Orders', 'yit'), 'menu-item-classes' => 'view-order', 'menu-item-url' => wc_get_endpoint_url('view-order', '', $my_account_url), 'menu-item-status' => 'publish')); if (!defined('YITH_WCWL')) { wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Wishlist', 'yit'), 'menu-item-classes' => 'wishlist', 'menu-item-url' => wc_get_endpoint_url('wishlist', '', $my_account_url), 'menu-item-status' => 'publish')); } wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Edit Address', 'yit'), 'menu-item-classes' => 'edit-address', 'menu-item-url' => wc_get_endpoint_url('edit-address', '', $my_account_url), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Edit Account', 'yit'), 'menu-item-classes' => 'edit-account', 'menu-item-url' => wc_get_endpoint_url('edit-account', '', $my_account_url), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Logout', 'yit'), 'menu-item-classes' => 'customer-logout', 'menu-item-url' => wc_get_endpoint_url('customer-logout', '', $my_account_url), 'menu-item-status' => 'publish')); if (!has_nav_menu('welcome-menu')) { $locations = get_theme_mod('nav_menu_locations'); $locations['welcome-menu'] = $menu_id; set_theme_mod('nav_menu_locations', $locations); } } } } //Register footer sidebar for ($i = 1; $i <= yit_get_option('footer-rows', 0); $i++) { register_sidebar(yit_sidebar_args("Footer Row {$i}", sprintf(__("The widget area #%d used in Footer section", 'yit'), $i), 'widget col-sm-' . 12 / yit_get_option('footer-columns'), apply_filters('yit_footer_sidebar_' . $i . '_wrap', 'h5'))); } }
function yit_get_welcome_user_name($current_user) { // if firstname and last name are both not setted if (!$current_user->user_firstname && !$current_user->user_lastname) { if (is_shop_installed()) { $firstname_billing = get_user_meta($current_user->ID, "billing_first_name", true); $lastname_billing = get_user_meta($current_user->ID, "billing_last_name", true); // if firstname and last name in billing options are both not setted if (!$firstname_billing && !$lastname_billing) { $user_name = $current_user->user_nicename; } else { $user_name = $firstname_billing . ' ' . $lastname_billing; } } else { $user_name = $current_user->user_nicename; } } else { $user_name = $current_user->user_firstname . ' ' . $current_user->user_lastname; } if ($user_name == ' ') { $user_name = $current_user->user_login; } return $user_name; }
/** * Retrieve the post id * * @return integer * @since 1.0.0 */ function yit_post_id() { global $post; $post_id = 0; if (is_posts_page()) { $post_id = get_option('page_for_posts'); } elseif (is_shop_installed() && (is_shop() || is_product_category() || is_product_tag() || is_product_attribute())) { $post_id = woocommerce_get_page_id('shop'); } elseif (isset($post->ID)) { $post_id = $post->ID; } return $post_id; }
yit_add_option_metabox( 'yit-page-settings', __( 'SEO', 'yit' ), '_seo-keywords', 'text', $options ); yit_add_option_metabox( 'yit-post-settings', __( 'SEO', 'yit' ), '_seo-keywords', 'text', $options ); if( is_shop_installed() ) { yit_add_option_metabox( 'yit-custom-product-settings', __( 'SEO', 'yit' ), '_seo-keywords', 'text', $options ); } yit_metaboxes_sep( 'yit-page-settings', __( 'SEO', 'yit' ) ); $options = array( 'title' => __( 'Description', 'yit' ), 'desc' => __( 'Description for this page.', 'yit' ), ); yit_add_option_metabox( 'yit-page-settings', __( 'SEO', 'yit' ), '_seo-description', 'text', $options ); yit_add_option_metabox( 'yit-post-settings', __( 'SEO', 'yit' ), '_seo-description', 'text', $options ); if( is_shop_installed() ) { yit_add_option_metabox( 'yit-custom-product-settings', __( 'SEO', 'yit' ), '_seo-description', 'text', $options ); } yit_metaboxes_sep( 'yit-page-settings', __( 'SEO', 'yit' ) ); /** * HEADER TAB */ $options = array( 'title' => __( 'Slider', 'yit' ), 'options' => array( '' => __( 'Default', 'yit' ), 'none' => __( 'None', 'yit' ) ) + yit_get_sliders(), 'desc' => __( 'Select the slider that you want to use in the page.', 'yit' ), ); yit_add_option_metabox( 'yit-page-settings', __( 'Header', 'yit' ), '_slider_name', 'select', $options ); yit_metaboxes_sep( 'yit-page-settings', __( 'Header', 'yit' ) );
?> > <?php } ?> </div> <?php } ?> <?php if ($show_breadcrumb) { ?> <!-- BREDCRUMB --> <div class="breadcrumbs"> <?php do_action('yit_before_breadcrumb'); if (!is_shop_installed() || is_shop_enabled() && !is_woocommerce()) { yit_breadcrumb(apply_filters('yit_breadcrumb_delimiter', '|')); } ?> </div> <?php } ?> </div></div></div> </div> <!-- END PAGE META --> <?php }
function widget($args, $instance) { extract($args); $title = isset($instance['title']) ? $instance['title'] : ''; echo $before_widget; $search_type = yit_get_option('search_type'); if (!is_shop_installed() && $search_type == 'product') { $search_type = 'post'; } ?> <?php $icon = yit_get_option('header-search-mini-icon'); $image_attr = yit_getimagesize($icon['custom']); if ($icon['select'] == 'icon') { $i = '<i class="fa fa-' . $icon['icon'] . '"></i>'; } else { $i = '<span><img src="' . $icon['custom'] . '" ' . $image_attr[3] . ' alt="' . __("Search", "yit") . '"/></span>'; } ?> <a href="#" class="search_mini_button"><?php echo $i; ?> </a> <div class="search_mini_content slideInDown"> <?php echo yit_get_header_skin() == 'skin1' ? '<div class="container">' : ''; ?> <?php if (defined('YITH_WCAS')) { ?> <?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?> <?php } else { ?> <form action="<?php echo home_url('/'); ?> " method="get" class="search_mini"> <input type="text" name="s" id="search_mini" value="<?php the_search_query(); ?> " placeholder="<?php if (is_shop_installed()) { _e('search for products', 'yit'); } else { _e('search for...', 'yit'); } ?> " /><input type="submit" value="" id="mini-search-submit" /> <input type="hidden" name="post_type" value="<?php echo $search_type; ?> " /> </form> <?php } ?> <?php echo yit_get_header_skin() == 'skin1' ? '</div>' : ''; ?> </div> <?php echo $after_widget; }
<?php /** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ if (!is_shop_installed() || !is_shop_enabled() || !yit_get_option('show-header-woocommerce-cart')) { return; } ?> <div class="woo_cart<?php if (!yit_get_option('responsive-show-header-cart')) { echo ' hidden-phone'; } ?> "> <?php the_widget('YIT_Widget_Cart'); ?> </div>
/** * Get a specific option value from the database * * @since 1.0.0 * @param $id string * @return array */ public function get_option($id, $default = false) { global $post; $post_meta = ''; if (is_posts_page()) { $post_id = get_option('page_for_posts'); } elseif (is_shop_installed() && (is_shop() || is_product_category() || is_product_tag())) { $post_id = function_exists('wc_get_page_id') ? wc_get_page_id('shop') : woocommerce_get_page_id('shop'); } elseif (isset($post->ID)) { $post_id = $post->ID; } else { $post_id = 0; } // get eventual custom field hidden from the post, that have the same ID if ($post_id != 0) { $post_meta = get_post_meta($post_id, '_' . $id, true); } // get eventual custom field from the post, that have the same ID if ($post_id != 0 && empty($post_meta)) { $post_meta = get_post_meta($post_id, $id, true); } // return custom field, if it exists if ($post_meta != '') { // the only way to check, because with ! empty( $post_meta ) doesn't get the value "0" from the custom field return stripslashes_deep($post_meta); // otherwise return the value from database, if it exists } elseif (isset($this->db_options[$id])) { return stripslashes_deep($this->db_options[$id]); // else return the default value from the options array, if it's not defined a default value in method parameter } elseif (!$default) { $new_value = $this->get_default_option($id); $this->update_option($id, $new_value); return stripslashes_deep($new_value); // else return the default value from the method parameter } else { return stripslashes_deep($default); } }
/** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ $show_cart = yit_get_option('show-header-woocommerce-cart'); $show_cart_widget = yit_get_option('show-header-woocommerce-cart-widget'); $show_search = yit_get_option('show-header-search'); if (!is_shop_installed() || !is_shop_enabled()) { $show_cart = $show_cart_widget = false; } $responsive_header_cart = yit_get_option('responsive-show-header-cart'); $responsive_header_search = yit_get_option('responsive-show-header-search'); if (!$show_cart && !$show_cart_widget && !$show_search) { return; } global $woocommerce; ?> <div id="header-cart-search"> <?php if ($show_cart || $show_cart_widget) { ?> <div class="cart-row group<?php if (!$responsive_header_cart) {
* * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ $show_cart = yit_get_option('show-header-woocommerce-cart'); $show_cart_widget = yit_get_option('show-header-woocommerce-cart-widget'); $show_search = yit_get_option('show-header-search'); if( ! is_shop_installed() || ! is_shop_enabled() ) $show_cart = $show_cart_widget = false; $responsive_header_cart = yit_get_option('responsive-show-header-cart'); $responsive_header_search = yit_get_option('responsive-show-header-search'); if ( ! $show_cart && ! $show_cart_widget && ! $show_search ) return; global $woocommerce; ?> <div id="header-cart-search"> <?php if( ( $show_cart || $show_cart_widget ) && !yit_ywctm_hide_cart_page() ): ?> <div class="cart-row group<?php if ( ! $responsive_header_cart ) echo ' hidden-phone' ?>"> <?php if( $show_cart == '1' ): ?> <?php list( $cart_items, $cart_subtotal, $cart_currency ) = yit_get_current_cart_info(); ?>
<a href="<?php echo $profile_link; ?> "><?php echo $user_name; ?> <span class="sf-sub-indicator"> +</span></a> </div> <div class="welcome_menu hidden-phone"> <div class="welcome_menu_inner"> <?php if (!$logged_in) { ?> <?php if (is_shop_installed() && is_shop_enabled()) { global $woocommerce; ?> <form method="post" action="<?php echo get_permalink(get_option('woocommerce_myaccount_page_id')); ?> " class="group"> <input type="text" name="username" id="header_username" placeholder="<?php _e('Username', 'yit'); ?> " /> <input type="password" name="password" id="header_password" placeholder="<?php _e('Password', 'yit'); ?> " />
$sitemap['archives'] = '<h3>' . YIT_Sitemap()->get_option( 'sitemap-archive-title' ) . '</h3>'; $sitemap['archives'] .= '<ul>'; $sitemap['archives'] .= wp_get_archives(array( 'type' => YIT_Sitemap()->get_option( 'sitemap-archive-type' ), 'limit' => YIT_Sitemap()->get_option( 'sitemap-archive-limit' ) == -1 ? '' : YIT_Sitemap()->get_option( 'sitemap-archive-limit' ), 'show_post_count' => ( strcmp( YIT_Sitemap()->get_option( 'sitemap-archive-show-count' ), 'no' ) == 0 ) ? false : true , 'echo' => 0 )); $sitemap['archives'] .= '</ul>'; } //get products if( function_exists( 'WC' ) && in_array('products', $order) && is_shop_installed()) { $categories = get_terms( 'product_cat', array( 'hide_empty' => 0 )); $columns = 4; $sitemap['products'] = '<h3>' . YIT_Sitemap()->get_option( 'sitemap-product-title' ) . '</h3>'; if( YIT_Sitemap()->get_option( 'sitemap-product-items' ) == -1 ){ foreach($categories as $category) { //get posts in category
<?php if($title): ?> <h1><?php echo $title ?></h1> <?php endif ?> <div class="sitemap row"> <?php $order = array(); $order = json_decode(stripslashes(yit_get_option('sitemap-order')), true); if( !empty($order) ) { $order = array_keys($order['include']); } $is_shop_installed = is_shop_installed(); $sitemap = array(); //get pages if( in_array('pages', $order) ) { //retrieve pages with metabox _exclude-sitemap setted to On $args = array( 'fields' => 'ids', 'post_type' => 'page', 'meta_query' => array( array( 'key' => '_exclude-sitemap', 'value' => '1', 'compare' => '=' ) ) ); $query = new WP_Query( $args );
/** * Add the style for variations dropdowns scrollable. */ function yit_scrollable_variations() { if (is_shop_installed() && !is_product()) { return; } if (yit_get_option('shop-variations-scrollable')) { ?> <style> .variations .select-wrapper .sbOptions { max-height: <?php echo yit_get_option('shop-variations-scrollable-height'); ?> px !important; overflow: scroll; } </style> <?php } }
function widget($args, $instance) { $show_logged_out = isset($instance['show_logged_out']) ? $instance['show_logged_out'] : 'yes'; $show_logged_in = isset($instance['show_logged_in']) ? $instance['show_logged_in'] : 'yes'; $title_logged_out = isset($instance['title_logged_out']) ? $instance['title_logged_out'] : ''; $nav_menu = isset($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : ''; $nav_show_wishlist = isset($instance['nav_show_wishlist']) && $instance['nav_show_wishlist'] == 'yes' && defined('YITH_WCWL') ? true : false; $nav_show_wpml_menu = isset($instance['nav_show_wpml_menu']) && $instance['nav_show_wpml_menu'] == 'yes' && defined('ICL_SITEPRESS_VERSION') ? true : false; // var_dump($instance); $logged_in = false; if (is_user_logged_in()) { $logged_in = true; global $current_user; get_currentuserinfo(); $user_name = $current_user->display_name; if (empty($user_name)) { $user_name = __('user', 'yit'); } ?> <!-- START LOGGED IN NAVIGATION --> <div id="welcome-menu" class="nav dropdown"> <ul> <li class="menu-item<?php if ($show_logged_in == 'yes') { echo ' dropdown'; } ?> "> <a href="<?php echo get_permalink(wc_get_page_id('myaccount')); ?> "> <span class="welcome_username"><?php echo apply_filters('yit_welcome_login_label', __('Hi', 'yit')); ?> <?php echo apply_filters('yit_welcome_username', $user_name); ?> </span> </a> <?php if ($show_logged_in == 'yes') { include_once YIT_THEME_ASSETS_PATH . '/lib/Walker_Nav_Menu_Div.php'; $nav_args = array('menu' => $nav_menu, 'container' => 'div', 'container_class' => 'submenu', 'menu_class' => 'sub-menu clearfix', 'depth' => 1, 'walker' => new YIT_Walker_Nav_Menu_Div()); wp_nav_menu($nav_args); } ?> </li> </ul> </div> <!-- END LOGGED IN NAVIGATION --> <?php } else { $enabled_registration = get_option('woocommerce_enable_myaccount_registration'); $enabled_registration_class = $enabled_registration === 'yes' ? 'with_registration' : ''; $profile_link = is_shop_installed() ? get_permalink(wc_get_page_id('myaccount')) : wp_login_url(); ?> <div id="welcome-menu-login" class="nav"> <ul id="menu-welcome-login"> <li class="menu-item login-menu<?php if ($show_logged_out == 'yes') { echo ' dropdown'; } ?> "> <a href="<?php echo esc_url($profile_link); ?> "><?php echo $title_logged_out; ?> </a> <?php if ($show_logged_out == 'yes') { ?> <div class="submenu clearfix"> <div class="clearfix login-box <?php echo esc_attr($enabled_registration_class); ?> "> <div id="customer_login"> <div class="customer-login-box customer-login-box1"> <form method="post" class="login"> <?php do_action('woocommerce_login_form_start'); ?> <div class="form-group"> <label for="username"><?php _e('Username or email address', 'yit'); ?> <span class="required">*</span></label> <input type="text" class="form-control" name="username" id="username" /> </div> <div class="form-group"> <label for="password"><?php _e('Password', 'yit'); ?> <span class="required">*</span></label> <input class="form-control" type="password" name="password" id="password" /> </div> <?php do_action('woocommerce_login_form'); ?> <div class="form-group login-submit"> <?php wp_nonce_field('woocommerce-login'); ?> <input type="submit" class="button btn btn-flat-red button-login" name="login" value="<?php _e('Login', 'yit'); ?> " /> <p class="lost_password"> <?php if (function_exists('wc_lostpassword_url')) { ?> <a href="<?php echo esc_url(wc_lostpassword_url()); ?> "><?php _e('Lost password?', 'yit'); ?> </a><br /> <?php } ?> <?php if ($enabled_registration === 'yes') { ?> <?php _e('New Customer ?', 'yit'); ?> <a class="signup" href="<?php echo esc_url(is_shop_installed() ? get_permalink(wc_get_page_id('myaccount')) : wp_registration_url()); ?> "><?php _e('Sign up', 'yit'); ?> </a> <?php } ?> </p> <!-- <label for="rememberme" class="inline"> <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember me', 'yit'); ?> </label> --> </div> <?php do_action('woocommerce_login_form_end'); ?> </form> </div> </div> </div> </div> <?php } ?> </li> </ul> </div> <?php } if ($nav_show_wishlist) { ?> <div class="nav whislist_nav"> <ul> <li> <a href="<?php echo wc_get_endpoint_url('wishlist', '', get_permalink(wc_get_page_id('myaccount'))); ?> "><?php _e('My Wishlist', 'yit'); ?> </a> </li> </ul> </div> <?php } }
* that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ /* === INIT & CORE */ add_filter( 'yit_custom_style', 'yit_meta_like_body' ); add_filter( 'yith_wcwl_tab_options', 'yit_remove_wishlist_text_option' ); /* === HEADER */ add_action( 'yit_head', 'yit_head', 10 ); add_action( 'wp_enqueue_scripts', 'yit_add_custom_styles' ); add_action( 'wp_enqueue_scripts', 'yit_add_custom_scripts' ); add_action( 'wp_enqueue_scripts', 'yit_load_touch_punch_js' , 35 );//filter price touch on mobile fix add_action( 'wp_enqueue_scripts', 'yit_global_object', 100 ); if(is_shop_installed()) add_action( 'wp_enqueue_scripts', 'yit_woocommerce_object', 110 ); add_action( 'yit_before_header', 'yit_topbar', 10 ); add_action( 'wp_head', 'yit_og_taxonomy_terms_image' ); //add_action( 'yit_topbar_login', 'yit_topbar_login', 10 ); add_action( 'yit_header', 'yit_header', 10 ); add_action( 'yit_after_header', 'yit_slider_section', 10 ); add_action( 'yit_logo', 'yit_logo', 10 ); add_action( 'yit_after_logo', 'yit_header_sidebar', 20 ); add_action( 'yit_after_logo', 'yit_header_cartsearch', 10 ); add_action( 'yit_main_navigation', 'yit_main_navigation', 10 ); add_action( 'yit_after_header', 'yit_page_meta', 20 ); add_action( 'yit_after_header', 'yit_slogan', 30 ); add_action( 'yit_loop_page', 'yit_map', 20 );
/** * Get a specific option value from the database * * @param string $id string * @param bool|string $default string * * @return mixed * @since 2.0.0 * @author Antonino Scarfi' <*****@*****.**> */ public function get_option($id, $default = false) { global $post, $wp_query; $post_meta = ''; if (isset($wp_query->is_posts_page) && $wp_query->is_posts_page) { $post_id = get_option('page_for_posts'); } elseif (is_shop_installed() && (is_shop() || is_product_category() || is_product_tag())) { $post_id = wc_get_page_id('shop'); } elseif (isset($post->ID)) { $post_id = $post->ID; } else { $post_id = 0; } // get eventual custom field hidden from the post, that have the same ID if ($post_id != 0) { $post_meta = get_post_meta($post_id, '_' . $id, true); } // get eventual custom field from the post, that have the same ID if ($post_id != 0 && empty($post_meta)) { $post_meta = get_post_meta($post_id, $id, true); } // return custom field, if it exists if (!in_array($post_meta, array('', 'default'))) { // the only way to check, because with ! empty( $post_meta ) doesn't get the value "0" from the custom field $val = stripslashes_deep($post_meta); // otherwise return the value from database, if it exists } elseif (isset($this->db_options[$id]) && in_array($post_meta, array('', 'default'))) { $val = stripslashes_deep($this->db_options[$id]); // else return the default value from the options array, if it's not defined a default value in method parameter } elseif (!$default) { $defaults = $this->get_default_options(); if (!isset($defaults[$id])) { $val = null; } else { $this->update_option($id, $defaults[$id]); $val = stripslashes_deep($defaults[$id]); } // else return the default value from the method parameter } else { $val = stripslashes_deep($default); } return apply_filters('yit_get_option', $val, $id, $default); }
/** * Generate the module * * @since 1.0.0 */ public function module( $name_or_id, $action, $echo = true ) { global $is_footer; $this->current_form = is_int( $name_or_id ) ? $name_or_id : yit_post_id_from_slug( $name_or_id, 'contactform' ); $form_name = yit_post_slug_from_id( $this->current_form ); $general_message = $this->_generalMessage( $this->current_form, false ); $fields = $this->get('fields'); if( !is_array( $fields ) OR empty( $fields ) ) return null; $max_width = ''; foreach( $fields as $id => $field ) { preg_match( '/[\d]+/', $field['width'], $matches ); if( $max_width < ( int ) $matches[0] ) { $max_width = $matches[0]; } } $html = '<form id="contact-form-' . $form_name . '" class="contact-form' . ( !$is_footer ? ' row-fluid' : '' ) .'" method="post" action="'.$action.'" enctype="multipart/form-data">' . "\n\n"; // div message feedback $html .= "\t<div class=\"usermessagea\">" . $general_message . "</div>\n"; $html .= "\t<fieldset>\n\n"; $html .= "\t\t<ul>\n\n"; // array with all messages for js validate $js_messages = array(); $current_total_width = 0; $i = 0; foreach( $fields as $id => $field ) { // classes $input_class = array(); // array for print input's classes $li_class = array( $field['type'] . '-field' ); // array for print li's classes // errors $error_msg = ''; $error = false; $js_messages[ $field['data_name'] ] = $field['error']; if ( isset( $field['data_name'] ) ) { $error_msg = $this->_getMessage( $field['data_name'] ); if ( ! empty( $error_msg ) ) $error = TRUE; } // li class if( $field['class'] != '' ) $li_class[] = " $field[class]"; if ( isset( $field['icon'] ) && $field['icon'] != '' ) array_push( $li_class, 'with-icon'); /** Clear left margin for first element */ /* $current_total_width = $current_total_width + str_replace('span','',$field['width']); if ( $current_total_width > 12 ) { $current_total_width = str_replace('span','',$field['width']); array_push( $li_class, 'first-of-line'); } */ if( $error ) array_push( $input_class, 'icon', 'error' ); if ( isset( $field['icon'] ) && $field['icon'] != '' ) { array_push( $input_class, 'with-icon'); } $html .= "\t\t\t<li class=\"" . implode( $li_class, ' ' ) . ' ' . $field['width'] . "\">\n"; //Label /* if( $field['type'] != 'select' ) { if( $field['type'] != 'radio' ) $html .= "\t\t\t\t<label for=\"$field[data_name]-$form_name\">\n"; else $html .= "\t\t\t\t<label>\n"; $html .= yit_string( "\t\t\t\t\t" . '<span class="mainlabel">', stripslashes_deep( $field['title'], 'highlight-text' ), '</span>' . "\n", false ); if( isset( $field['required'] ) ) $html .= "\t\t\t\t\t" . '<span class="required">' . __('(required)','yit') . '</span>' . "\n"; $html .= yit_string( "\t\t\t\t\t" . '<span class="sublabel">', stripslashes_deep( $field['description'] ), '</span>' . "\n", false ); $html .= "\t\t\t\t</label>\n"; } else { if(isset($field['description']) || $field['description'] != '') { $html .= "\t\t\t\t<label>\n"; if( isset( $field['required'] ) ) $html .= "\t\t\t\t\t" . '<span class="required">' . __('(required)','yit') . '</span>' . "\n"; $html .= yit_string( "\t\t\t\t\t" . '<span class="sublabel">', stripslashes_deep( $field['description'] ), '</span>' . "\n", false ); $html .= "\t\t\t\t</label>\n"; } $field['options'] = array( 'the-form-label' => $field['title'] ) + $field['options']; } */ // if required if( isset( $field['required'] ) AND intval( $field['required'] ) ) $input_class[] = 'required'; if( isset( $field['is_email'] ) AND intval( $field['is_email'] ) ) $input_class[] = 'email-validate'; // retrive value if( isset( $field['data_name'] ) && ( empty( $general_message ) || $error ) ) $value = $this->_postValue( $field['data_name'] ); else if ( isset( $_GET[ $field['data_name'] ] ) ) $value = $_GET[ $field['data_name'] ]; else $value = ''; // only for clean code $html .= "\t\t\t\t"; // Icon $html .= "<div class=\"input-prepend\">"; if ( isset( $field['icon'] ) && $field['icon'] != '' ) { if( filter_var( $field['icon'], FILTER_VALIDATE_URL ) ) { $html .= "<span class=\"add-on\"><img src=\"". $field['icon'] . "\" alt=\"\" title=\"\" /></span>"; } else { $html .= "<span class=\"add-on\"><i class=\"icon-" . $field['icon'] . "\"></i></span>"; } } // print type of input switch( $field['type'] ) { // text case 'text': $html .= "<input type=\"text\" name=\"yit_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-$form_name\" class=\"" . implode( $input_class, ' ' ) . "\" value=\"$value\" placeholder=\"" . stripslashes_deep( $field['title'], 'highlight-text' ) . "\" />"; break; // hidden case 'hidden': $html .= "<input type=\"hidden\" name=\"yit_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-$form_name\" class=\"" . implode( $input_class, ' ' ) . "\" value=\"$value\" />"; break; // checkbox case 'checkbox': $checked = ''; if( $value != '' AND $value ) $checked = ' checked="checked"'; else if( isset($field['already_checked']) && intval( $field['already_checked'] ) ) $checked = ' checked="checked"'; $html .= "<input type=\"checkbox\" name=\"yit_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-$form_name\" value=\"1\" class=\"" . implode( $input_class, ' ' ) . "\"{$checked} />"; if ( isset( $field['title'] ) ) $html .= ' ' . $field['title']; break; // select case 'select': $html .= "<select name=\"yit_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-$form_name\" class=\"" . implode( $input_class, ' ' ) . "\">\n"; // options foreach( $field['options'] as $id => $option ) { $selected = ''; if( isset($field['option_selected']) && $field['option_selected'] == $id ) $selected = ' selected="selected"'; if( $id === 'the-form-label' ) { $html .= "\t\t\t\t\t\t<option value=\"\"$selected>$option</option>\n"; } else { $html .= "\t\t\t\t\t\t<option value=\"$option\"$selected>$option</option>\n"; } } $html .= "\t\t\t\t\t</select>"; break; // textarea case 'textarea': $html .= "<textarea name=\"yit_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-$form_name\" rows=\"8\" cols=\"30\" class=\"" . implode( $input_class, ' ' ) . "\" placeholder=\"" . stripslashes_deep( $field['title'], 'highlight-text' ) . "\">$value</textarea>"; break; // radio case 'radio': // options foreach( $field['options'] as $i => $option ) { $selected = ''; if( isset($field['option_selected']) && $field['option_selected'] == $i ) $selected = ' checked=""'; $html .= "\t\t\t\t\t\t<input type=\"radio\" name=\"yit_contact[{$field['data_name']}]\" id=\"{$field['data_name']}-$form_name-$i\" value=\"$option\"$selected /><label for=\"{$field['data_name']}-$form_name-$i\">$option</label>\n"; } $html .= "\t\t\t\t<div class=\"clear\"></div>\n"; break; // password case 'password': $html .= "<input type=\"password\" name=\"yit_contact[{$field['data_name']}]\" id=\"{$field['data_name']}-$form_name\" class=\"" . implode( $input_class, ' ' ) . "\" value=\"$value\" />"; break; // file case 'file': $html .= "<input type=\"file\" name=\"yit_contact[{$field['data_name']}]\" id=\"{$field['data_name']}-$form_name\" class=\"" . implode( $input_class, ' ' ) . "\" />"; break; } // Icon $html .= "</div>"; // only for clean code $html .= "\n"; $html .= "\t\t\t\t<div class=\"msg-error\">" . $error_msg . "</div><div class=\"clear\"></div>\n"; $html .= "\t\t\t</li>\n"; } if ( $this->get('enable_captcha' ) == '1') { $html .= "<script type=\"text/javascript\">var RecaptchaOptions = { theme : 'clean' };</script>"; $html .= "<li class=\"first-of-line span-12\">"; $html .= $this->recaptcha( false ); $html .= "</li><div class=\"clear\"></div>"; } $html .= "\t\t\t<li class=\"submit-button span" . $max_width . "\">\n"; $html .= "\t\t\t\t<input type=\"text\" name=\"yit_bot\" id=\"yit_bot\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"yit_action\" value=\"sendemail\" id=\"yit_action\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"yit_referer\" value=\"" . yit_curPageURL() . "\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"$this->current_form\" />\n"; if ( is_shop_installed() && is_product() ) { $html .= "\t\t\t\t<input type=\"hidden\" name=\"yit_contact[sku]\" value=\"". $GLOBALS['product']->sku . "\" />"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"yit_contact[product_id]\" value=\"". $GLOBALS['product']->id . "\" />"; } $html .= "\t\t\t\t<input type=\"submit\" name=\"yit_sendemail\" value=\"" . $this->get('submit_label') . "\" class=\"sendmail " . $this->get('submit_alignment') . "\" />"; $html .= "\t\t\t\t" . wp_nonce_field( 'yit-sendmail', "_wpnonce", true, false ); $html .= "\t\t\t\t<div class=\"clear\"></div>"; $html .= "\t\t\t</li>\n"; $html .= "\t\t</ul>\n\n"; $html .= "\t</fieldset>\n"; //$html .= "<div class=\"general-msg-error\">" . __('* Please fix the errors and send again the message', 'yit') . "</div>"; $html .= "<div class=\"contact-form-error-messages\">"; foreach( $js_messages as $id => $msg ) if(isset($msg) && $msg != '') $html .= "<div class=\"contact-form-error-$id contact-form-error\">* $msg</div>\n"; $html .= "</div>\n"; $html .= "</form>\n\n"; $html .= "<div class=\"clear\"></div>"; /* // messages for javascript validation $html .= "<script type=\"text/javascript\">\n"; $html .= "\tvar messages_form_" . $this->current_form . " = {\n"; foreach( $js_messages as $id => $msg ) if(isset($msg) && $msg != '') $html .= "\t\t$id: \"$msg\",\n"; // remove last comma $html = str_replace( "\t\t$id: \"$msg\",\n", "\t\t$id: \"$msg\"\n", $html ); $html .= "\t};\n"; $html .= "</script>"; */ $html .= "<script type=\"text/javascript\" src=\"" . get_template_directory_uri() . "/theme/assets/js/contact.js\"></script>"; if( $echo ) echo $html; return $html; }
function widget($args, $instance) { extract($args); $show_logged_out = isset($instance['show_logged_out']) ? $instance['show_logged_out'] : 'yes'; $show_logged_out_submenu = isset($instance['show_logged_out_submenu']) ? $instance['show_logged_out_submenu'] : 'yes'; $title_logged_out = isset($instance['title_logged_out']) ? $instance['title_logged_out'] : ''; $show_logged_in = isset($instance['show_logged_in']) ? $instance['show_logged_in'] : 'yes'; $nav_menu = isset($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : ''; $logged_in = false; if (is_user_logged_in() && $show_logged_in == 'yes') { $logged_in = true; global $current_user; get_currentuserinfo(); $user_name = yit_get_welcome_user_name($current_user); ?> <!-- START LOGGED IN NAVIGATION --> <div id="welcome-menu" class="nav dropdown"> <ul> <li class="menu-item dropdown"><a href="#"><span class="welcome_username"><?php echo apply_filters('yit_welcome_login_label', __('Welcome, ', 'yit')) . apply_filters('yit_welcome_username', $user_name); ?> </span> </a> <?php include_once YIT_THEME_ASSETS_PATH . '/lib/Walker_Nav_Menu_Div.php'; $nav_args = array('menu' => $nav_menu, 'container' => 'div', 'container_class' => 'submenu', 'menu_class' => 'sub-menu clearfix', 'depth' => 1, 'walker' => new YIT_Walker_Nav_Menu_Div()); wp_nav_menu($nav_args); ?> </li> </ul> </div> <!-- END LOGGED IN NAVIGATION --> <?php } elseif ($show_logged_out == 'yes') { $enabled_registration = get_option('woocommerce_enable_myaccount_registration'); $enabled_registration_class = $enabled_registration === 'yes' ? 'with_registration' : ''; $profile_link = is_shop_installed() ? get_permalink(wc_get_page_id('myaccount')) : wp_login_url(); if (function_exists('icl_translate')) { $title_logged_out = icl_translate('Widgets', 'widget_woocommerce_login_title_logged_out' . sanitize_title($title_logged_out), $title_logged_out); } ?> <div id="welcome-menu-login" class="nav"> <ul id="menu-welcome-login"> <li class="menu-item login-menu"> <a href="<?php echo esc_url($profile_link); ?> "><?php echo $title_logged_out; ?> <span class="sf-sub-indicator"> +</span></a> <?php if ($show_logged_out_submenu == 'yes') { ?> <div class="submenu clearfix" style="display: none;"> <div class="clearfix login-box <?php echo $enabled_registration_class; ?> "> <div id="customer_login"> <div class="customer-login-box customer-login-box1"> <h4><?php _e('Login', 'yit'); ?> </h4> <form method="post" class="login"> <?php do_action('woocommerce_login_form_start'); ?> <div class="form-group"> <label for="username"><?php _e('Username or email address', 'yit'); ?> <span class="required">*</span></label> <input type="text" class="form-control" name="username" id="username" value="<?php if (!empty($_POST['username'])) { echo esc_attr($_POST['username']); } ?> "/> </div> <div class="form-group"> <label for="password"><?php _e('Password', 'yit'); ?> <span class="required">*</span></label> <input class="form-control" type="password" name="password" id="password" /> </div> <?php do_action('woocommerce_login_form'); ?> <div class="form-group"> <?php wp_nonce_field('woocommerce-login'); ?> <input type="submit" class="button button-login" name="login" value="<?php _e('Login', 'yit'); ?> " /> <p class="lost_password"> <a href="<?php echo esc_url(wp_lostpassword_url()); ?> "><?php _e('Lost password?', 'yit'); ?> </a> </p> <!-- <label for="rememberme" class="inline"> <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember me', 'yit'); ?> </label> --> </div> <div class="form-group"> <?php if (defined('NEW_FB_LOGIN') && NEW_FB_LOGIN == 1 && function_exists('new_fb_sign_button')) { ?> <div class="fb-connect"> <div class="btn-fb-login"> <a href="<?php echo new_fb_login_url(); ?> &redirect=<?php echo site_url(); ?> /" onclick="window.location = '<?php echo home_url(); ?> /wp-login.php?loginFacebook=1&redirect=<?php echo site_url(); ?> /'; return false;"><?php echo do_shortcode('[icon icon_size="16" color="inherit" icon_type="theme-icon" icon_theme="facebook"]'); ?> Login with Facebook</a> </div> </div> <?php } ?> </div> <?php do_action('woocommerce_login_form_end'); ?> </form> </div> <?php if ($enabled_registration === 'yes') { ?> <div class="customer-login-box customer-login-box2"> <?php if (function_exists('wc_print_notices') && (!is_woocommerce() && !is_account_page() && !is_lost_password_page())) { ?> <?php wc_print_notices(); ?> <?php } ?> <h4><?php _e('First time here? Create your account', 'yit'); ?> </h4> <form method="post" class="register" id="login-form"> <?php do_action('woocommerce_register_form_start'); ?> <?php if (get_option('woocommerce_registration_generate_username') === 'no') { ?> <div class="form-group"> <label for="reg_username"><?php _e('Username', 'yit'); ?> <span class="required">*</span></label> <input type="text" class="form-control" name="username" id="reg_username" value="<?php if (!empty($_POST['username'])) { esc_attr($_POST['username']); } ?> " /> </div> <?php } ?> <div class="form-group"> <label for="reg_email"><?php _e('Email address', 'yit'); ?> <span class="required">*</span></label> <input type="email" class="form-control" name="email" id="reg_email" value="<?php if (!empty($_POST['email'])) { esc_attr($_POST['email']); } ?> " /> </div> <div class="form-group"> <?php if ('no' === get_option('woocommerce_registration_generate_password')) { ?> <p class="form-row form-row-wide"> <label for="reg_password"><?php _e('Password', 'yit'); ?> <span class="required">*</span></label> <input type="password" class="form-control" name="password" id="reg_password" /> </p> <?php } ?> </div> <!-- Spam Trap --> <div style="<?php echo is_rtl() ? 'right:-999em' : 'left:-999em'; ?> ; position:absolute;"><label for="trap"><?php _e('Anti-spam', 'yit'); ?> </label><input type="text" name="email_2" id="trap" tabindex="-1" /></div> <?php class_exists('YITH_Vendors_Frontend_Premium') && remove_action('woocommerce_register_form', array(YITH_Vendors()->frontend, 'register_form')); ?> <?php do_action('woocommerce_register_form'); ?> <?php do_action('register_form'); ?> <?php class_exists('YITH_Vendors_Frontend_Premium') && add_action('woocommerce_register_form', array(YITH_Vendors()->frontend, 'register_form')); ?> <div class="form-group"> <?php wp_nonce_field('woocommerce-register'); ?> <input type="submit" class="button button-register" name="register" value="<?php _e('Register →', 'yit'); ?> " /> </div> <?php do_action('woocommerce_register_form_end'); ?> </form> </div> </div> <?php } ?> </div> </div> <?php } ?> </li> </ul> </div> <?php } }