kreamweb
10/27/2016 - 9:58 AM

Ajax search template wider

Ajax search template wider

<?php
/**
 * YITH WooCommerce Ajax Search template
 *
 * @author  Yithemes
 * @package YITH WooCommerce Ajax Search Premium
 * @version 1.2.3
 */

if ( !defined( 'YITH_WCAS' ) ) {
    exit;
} // Exit if accessed directly


wp_enqueue_script( 'yith_wcas_frontend' );

$research_post_type = ( get_option('yith_wcas_default_research') ) ? get_option('yith_wcas_default_research') : 'product';
?>
<div class="yith-ajaxsearchform-container">
    <form role="search" method="get" id="yith-ajaxsearchform" action="<?php echo esc_url( home_url( '/' ) ) ?>">
        <div class="yith-ajaxsearchform-container">
            <div class="yith-ajaxsearchform-select">
            <?php
            if ( get_option( 'yith_wcas_show_search_list' ) == 'yes' ):

                $selected_search = ( isset( $_REQUEST['post_type'] ) ) ? $_REQUEST['post_type'] : $research_post_type; ?>

                <select class="yit_wcas_post_type selectbox" id="yit_wcas_post_type" name="post_type">
                    <option value="product" <?php selected( 'product', $selected_search ) ?>><?php _e( 'Products', 'yith-woocommerce-ajax-search' ) ?></option>
                    <option value="any" <?php selected( 'any', $selected_search ) ?>><?php _e( 'All', 'yith-woocommerce-ajax-search' ) ?></option>
                </select>

            <?php else: ?>
                <input type="hidden" name="post_type" class="yit_wcas_post_type" id="yit_wcas_post_type" value="<?php echo $research_post_type ?>" />
            <?php endif; ?>

            <?php
            if ( get_option( 'yith_wcas_show_category_list' ) == 'yes' ):

                $product_categories = yith_wcas_get_shop_categories( get_option( 'yith_wcas_show_category_list_all' ) == 'all' );

                $selected_category = ( isset( $_REQUEST['product_cat'] ) ) ? $_REQUEST['product_cat'] : '';

                if ( !empty( $product_categories ) ) : ?>
                    <select class="search_categories selectbox" id="search_categories" name="product_cat">
                        <option value="" <?php selected( '', $selected_category ) ?>><?php _e( 'All', 'yith-woocommerce-ajax-search' ) ?></option>
                        <?php foreach ( $product_categories as $cat ): ?>
                            <option value="<?php echo $cat->slug ?>" <?php selected( $cat->slug, $selected_category ) ?>><?php echo $cat->name ?></option>
                        <?php endforeach; ?>
                    </select>
                <?php endif ?>

            <?php endif ?>
            </div>
            <div class="search-navigation">
                <label class="screen-reader-text" for="yith-s"><?php _e( 'Search for:', 'yith-woocommerce-ajax-search' ) ?></label>
                <div class="search-input-container"><input type="search"
                       value="<?php echo get_search_query() ?>"
                       name="s"
                       id="yith-s"
                       class="yith-s"
                       placeholder="<?php echo get_option( 'yith_wcas_search_input_label' ) ?>"
                       data-append-to=".search-input-container"
                       data-loader-icon="<?php echo str_replace( '"', '', apply_filters( 'yith_wcas_ajax_search_icon', '' ) ) ?>"
                       data-min-chars="<?php echo get_option( 'yith_wcas_min_chars' ); ?>" /></div>
                <div class="search-submit-container"><input type="submit" id="yith-searchsubmit" value="<?php echo get_option( 'yith_wcas_search_submit_label' ) ?>" /></div>
            </div>
            

            <?php do_action( 'wpml_add_language_form_field' ); ?>
        </div>
    </form>
</div>
#yith-ajaxsearchform .search-navigation {
    display: table;
    width: 100%;
}

.search-input-container {
    display: table-cell;
    vertical-align: middle;
    padding: 0 15px 0 0;
}

input#yith-s {
    display: block;
    width: 100%;
    margin: 0;
}

.search-submit-container {
    display: table-cell;
    padding: 0 0 0 5px;
    width: 100px;
}

input#yith-searchsubmit {
    display: block;
    width: 100%;
    margin: 0;
}