Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    If you are talking about code for adding search form yo your site

    echo do_shortcode( ‘[aws_search_form]’ );

    than its depends on theme that you are using.

    You must find where your current theme has search form and replace its code with AWS plugin code.

    But there is another solution for you.

    To the very bottom of your functions.php file please add code

    add_filter( 'get_search_form', 'aws_search_form' );
    
    function aws_search_form( $form ) {
        return do_shortcode( '[aws_search_form]' );
    }

    Us I say all delends on your theme but its can work for you.

    Thread Starter adsantoli81

    (@adsantoli81)

    When I try to replace echo esc_url($Search_URL); with echo do_shortcode( ‘[aws_search_form]’ ); inside the searchform.php I get the error below:

    Parse error: syntax error, unexpected ‘’’ (T_STRING) in /home3/adsantoli/public_html/wp-content/themes/keep-calm-and-e-comm/searchform.php on line 5

    I also tried the second option adding the code at the bottom of the function.php file and it creates syntax errors, please advise

    Plugin Author ILLID

    (@mihail-barinov)

    Please show me the content of your theme searchform.php file and I will tell you how to add plugin search form in right way?

    Thanks.

    Thread Starter adsantoli81

    (@adsantoli81)

    <?php
    $Search_URL = esc_url( home_url(‘/’) );
    $Track_Orders_Label = __(‘Search’, ‘keep-calm-and-e-comm’);
    ?>
    <form id=”headerSearch” role=”search” method=”get” action=”<?php echo esc_url($Search_URL); ?>”>
    <input type=”text” name=”s” id=”headerSearchCatalog” placeholder=”<?php echo esc_attr($Track_Orders_Label); ?>”>
    </form>

    Plugin Author ILLID

    (@mihail-barinov)

    In this case please replace

    <form id=”headerSearch” role=”search” method=”get” action=”<?php echo esc_url($Search_URL); ?>”>
    <input type=”text” name=”s” id=”headerSearchCatalog” placeholder=”<?php echo esc_attr($Track_Orders_Label); ?>”>
    </form>

    with

    <?php echo do_shortcode( ‘[aws_search_form]’ ); ?>

    Thread Starter adsantoli81

    (@adsantoli81)

    I get the same error

    Parse error: syntax error, unexpected ‘’’ (T_STRING) in /home3/adsantoli/public_html/wp-content/themes/keep-calm-and-e-comm/searchform.php on line 5

    Plugin Author ILLID

    (@mihail-barinov)

    So inside your searchform.php file you must have

    <?php
    $Search_URL = esc_url( home_url(‘/’) );
    $Track_Orders_Label = __(‘Search’, ‘keep-calm-and-e-comm’);
    
    echo do_shortcode( ‘[aws_search_form]’ );

    Is that right?

    Plugin Author ILLID

    (@mihail-barinov)

    You even can short it to

    <?php
    echo do_shortcode( ‘[aws_search_form]’ );
    Thread Starter adsantoli81

    (@adsantoli81)

    take a look at my screen and tell me what im doing wrong:

    https://snag.gy/opk780.jpg

    Thread Starter adsantoli81

    (@adsantoli81)

    Plugin Author ILLID

    (@mihail-barinov)

    Try to remove

    $Search_URL = esc_url( home_url(‘/’) );
    $Track_Orders_Label = __(‘Search’, ‘keep-calm-and-e-comm’);

    from your file

    Leave only

    <?php
    echo do_shortcode( ‘[aws_search_form]’ );
    Thread Starter adsantoli81

    (@adsantoli81)

    Plugin Author ILLID

    (@mihail-barinov)

    Please also try to remove last empty line.

    Plugin Author ILLID

    (@mihail-barinov)

    If its doesn’t work – remove ‘echo’

    Thread Starter adsantoli81

    (@adsantoli81)

    none of that worked. thanks for trying

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Where do I add code to function.php file?’ is closed to new replies.