0

Here's the code. Please help me to resolve issue. I'm facing this issue,i am unable to use two different search bar in different pages please help in sorting this issue Please check where I'm doing wrong and help me out with this.

` <div class="header">
        <div class="row">
            <div class="container">
                <!-- Logo -->
                <div class="col-md-2 col-sm-12 col-xs-12">
                    <div class="logo">
                        <?php get_template_part( 'template-parts/layouts/site','logo' ); ?>
                    </div>
                </div>
                <!-- Category -->
                <div class="col-md-8 col-sm-9 col-xs-12">

                    <?php if (is_shop()) : ?>

                        <form role="search" method="get" class="search-form" id="searchform" action="' . esc_url( home_url( '/'  ) ) . '">
                            <div class="search-blog">
                                <div class="input-group stylish-input-group">
                                    <input class="form-control" placeholder="' . esc_html__( 'Search products...', 'adforest' ) . '" value="' . get_search_query() . '" name="s" type="search">
                                    <span class="input-group-addon">
                                <button type="submit"> <span class="fa fa-search"></span> </button>
                        </span>
                                </div>
                            </div>
                            <input type="hidden" name="post_type" value="product" />
                            <input class="search-submit" value="'.esc_html__('Search','adforest').'" type="submit">
                        </form>

                    <? else:
                        //TOP SEARCH BAR (Custom Abhi)
                        echo do_shortcode('[top_search_short_base cats="%5B%7B%22cat%22%3A%22all%22%7D%5D" locations="%5B%7B%7D%5D"]');
                    endif;
                    ?>

                </div>
                <!-- Post Button -->
                <div class="col-md-2 col-sm-12 no-padding col-xs-12">
                    <?php
                    if( isset( $adforest_theme['ad_in_menu'] ) && $adforest_theme['ad_in_menu'] )
                    {
                        $btn_text   =   __( 'Post Ad','adforest' );
                        if( isset( $adforest_theme['ad_in_menu_text'] ) &&  $adforest_theme['ad_in_menu_text'] != "" )
                        {
                            $btn_text   =   $adforest_theme['ad_in_menu_text'];
                        }
                        ?>
                        <a href="<?php echo get_the_permalink( $adforest_theme['sb_post_ad_page'] ); ?>" class="btn btn-orange btn-block">
                            <i class="fa fa-plus" aria-hidden="true"></i>
                            <?php echo esc_html($btn_text ); ?>
                        </a>
                        <?php
                    }
                    ?>
                </div>
            </div>
        </div>
    </div>`

1 Answers1

0

Try this code.

you need add <?php in else statement not <?

<div class="header">
    <div class="row">
        <div class="container">
            <!-- Logo -->
            <div class="col-md-2 col-sm-12 col-xs-12">
                <div class="logo">
                    <?php get_template_part( 'template-parts/layouts/site','logo' ); ?>
                </div>
            </div>
            <!-- Category -->
            <div class="col-md-8 col-sm-9 col-xs-12">

                <?php if (is_shop()) : ?>

                    <form role="search" method="get" class="search-form" id="searchform" action="' . esc_url( home_url( '/'  ) ) . '">
                        <div class="search-blog">
                            <div class="input-group stylish-input-group">
                                <input class="form-control" placeholder="' . esc_html__( 'Search products...', 'adforest' ) . '" value="' . get_search_query() . '" name="s" type="search">
                                <span class="input-group-addon">
                            <button type="submit"> <span class="fa fa-search"></span> </button>
                    </span>
                            </div>
                        </div>
                        <input type="hidden" name="post_type" value="product" />
                        <input class="search-submit" value="'.esc_html__('Search','adforest').'" type="submit">
                    </form>

                <?php else:
                    //TOP SEARCH BAR (Custom Abhi)
                    echo do_shortcode('[top_search_short_base cats="%5B%7B%22cat%22%3A%22all%22%7D%5D" locations="%5B%7B%7D%5D"]');
                endif;
                ?>

            </div>
            <!-- Post Button -->
            <div class="col-md-2 col-sm-12 no-padding col-xs-12">
                <?php
                if( isset( $adforest_theme['ad_in_menu'] ) && $adforest_theme['ad_in_menu'] )
                {
                    $btn_text   =   __( 'Post Ad','adforest' );
                    if( isset( $adforest_theme['ad_in_menu_text'] ) &&  $adforest_theme['ad_in_menu_text'] != "" )
                    {
                        $btn_text   =   $adforest_theme['ad_in_menu_text'];
                    }
                    ?>
                    <a href="<?php echo get_the_permalink( $adforest_theme['sb_post_ad_page'] ); ?>" class="btn btn-orange btn-block">
                        <i class="fa fa-plus" aria-hidden="true"></i>
                        <?php echo esc_html($btn_text ); ?>
                    </a>
                    <?php
                }
                ?>
            </div>
        </div>
    </div>
</div>
Vel
  • 9,027
  • 6
  • 34
  • 66