This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Not acting as default search

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #606
    NsidemanNsideman
    Participant

    Thank you for your previous help. I tried this on two themes and it does not replace the default search. I assume it is because the themes are doing something custom?

    Can you help me as to how I would make this plugin display on the main page and be the default search used?

    Thanks for any help you can offer. Also, is your jquery modal available as a plugin with shortcodes?

    When logging in you can ignore the google code field

    #612
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    To integrate the search into the template, you need to edit the template files, locate the template’s default search, then replace it with the ajax search pro shortcode. It requires intermediate knowledge of php/html and wordpress.

    Usually the search is located in the template’s head.php or header.php file.
    It’s ethier displayed with the built in function

     <?php get_search_form( $echo ); ?> 

    or something like this

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div><label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" name="s" id="s" />
            <input type="submit" id="searchsubmit" value="Search" />
        </div>
    </form>

    Basically you need to locate this (or similar) search code in the template and replace it with the ajax search pro shortcode, which you can get in the plugin settings page. ( )

    There is no exact way of doing this, since every template can have it’s own code, which is probably different for every template.

    You can read more about this here: http://codex.wordpress.org/Function_Reference/get_search_form

    • This reply was modified 11 years, 1 month ago by Ernest MarcinkoErnest Marcinko. Reason: wp link
    #614
    NsidemanNsideman
    Participant

    Understood. Thanks for the pointer.

    #645
    NsidemanNsideman
    Participant

    OK. So I have read up a little enough to figure out that this is the relevant section of code. However, my clumsy edits have not worked. Any pointers would be appreciated.

    <!– search –>
    <?php if ( empty( $data[‘head_show_search’] ) || ( !empty($data[‘head_show_search’]) && $data[‘head_show_search’] == ‘yes’) ) { ?>
    <div id=”search”>
    <span class=”icon-search icon-white”></span>
    <div class=”search”>
    <form id=”searchform” action=”<?php echo home_url(); ?>” method=”get”>
    <input name=”s” maxlength=”20″ class=”inputbox” type=”text” size=”20″ value=”<?php echo __( ‘SEARCH …’, THEMENAME );?>” onblur=”if (this.value==”) this.value='<?php echo __( ‘SEARCH …’, THEMENAME );?>’;” onfocus=”if (this.value=='<?php echo __( ‘SEARCH …’, THEMENAME );?>’) this.value=”;” />
    <input type=”submit” id=”searchsubmit” value=”go” class=”icon-search”/>
    </form>
    </div>
    </div>
    <!– end search –>

    #647
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Try to replace the upper code with this:

    <!– search –>
    <?php if ( empty( $data['head_show_search'] ) || ( !empty($data['head_show_search']) && $data['head_show_search'] == ‘yes’) ) { ?>
      <?php echo do_shortcode('[the search shortcode here...]'); ?>
    <?php } ?>
    <!– end search –>
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.