How do I add a search icon or search button to the search field?

6.88K viewsCore
0

By default I have this view in my anspress page:

What is the easiest way or instruction on how to add a search icon or search button to the search field? In order to have something like this:

 or like you have a “Search” button?

P.S. I’ve searched through support forum and couldn’t find it. Thank you in advance.

unselected answer

Are you using our theme?

No, it’s http://themeforest.net/item/dante-responsive-multipurpose-wordpress-theme/6175269. I guess it should be pretty easy like to add extra line of code to specific file. Could you please point me in the right direction?

As an option I can hide the default search field and use a widget search in order to get that button.

1

Hello Volodymyr Pekh,

Yes, you can hide AnsPress default search form and add custom form like this:

<form id="ap-search-form" class="ap-search-form" action="<?php echo ap_get_link_to('search'); ?>" method="GET">
	<div class="ap-qaf-inner">
		<input class="form-control" type="text" name="ap_s" id="ap-quick-ask-input" placeholder="<?php _e('Search questions & answers', 'anspress-question-answer'); ?>" value="<?php echo sanitize_text_field(get_query_var('ap_s')); ?>" autocomplete="off" />
		<button type="submit" ><?php _e('Search', 'anspress-question-answer'); ?></button>
	</div>
</form>

Just make sure form action should point to:

action="<?php echo ap_get_link_to('search'); ?>"
commented on answer

Hi @ravi! Thank you a lot for your answer. This is really helpful. I have one more question related to the search functionality.

Is there a chance to enable a search across all answers and comments? Even when I search for answers/comments on this support forum I got 0 results. For example let’s try the exact phrase from your answer above like “hide AnsPress default search form” – I get 0 results. Is it something I can enable or is it a current limitation of a plugin? Thank you in advance.

Hi @ravi! Thank you a lot for your answer. This is really helpful. I have one more question related to the search functionality.

Is there a chance to enable a search across all answers and comments? Even when I search for answers/comments on this support forum I got 0 results. For example let’s try the exact phrase from your answer above like “hide AnsPress default search form” – I get 0 results. Is it something I can enable or is it a current limitation of a plugin? Thank you in advance.

You are viewing 1 out of 1 answers, click here to view all answers.