Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Not acting as default search
This topic contains 4 replies, has 2 voices, and was last updated by Ernest Marcinko 11 years ago.
- AuthorPosts
- August 12, 2013 at 12:17 pm #606
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
August 13, 2013 at 9:38 am #612Hi!
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 ago by
Ernest Marcinko. Reason: wp link
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 13, 2013 at 2:33 pm #614Understood. Thanks for the pointer.
August 21, 2013 at 2:41 am #645OK. 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 –>August 21, 2013 at 7:34 am #647Try 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 –>
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This reply was modified 11 years ago by
- AuthorPosts
You must be logged in to reply to this topic.