Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Top searches
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 8 years, 6 months ago.
- AuthorPosts
- March 1, 2015 at 3:45 pm #4092
Hi,
I want display Top searches below in search box. What function should I type in the line 8 ?1 switch($style){
2 case “4”: {
3 $STRING .= ‘<div class=”col-md-3 col-sm-6 col-xs-12″ id=”core_logo”><a
4 href=”‘.get_home_url().’/” title=”‘.get_bloginfo(‘name’).'”>’.hook_logo(true).’
5 </div>’;
6 $STRING .= ‘<div class=”col-md-4 col-sm-6 col-xs-12″>
7 <div style=”margin:10px” >’.do_shortcode(‘[wpdreams_ajaxsearchpro id=4]‘).'</div>
8 <div> Put Top search in here </div>
9 </div>’;Best
KenAttachments:
You must be logged in to view attached files.March 2, 2015 at 12:05 pm #4098Hi!
Since there is no shortcode available yet for the top searches, I suggest to create a widgetized area to that location, and add the “Top searches” widget there. So your code would look like this (line 7-9):
7 <div style="margin:10px" >'.do_shortcode('[wpdreams_ajaxsearchpro id=4]').'</div> 8 <div> '.dynamic_sidebar( 'asp_top_searches_widget' ).' </div> 9 </div>';
and, you will need to initialize that widgetized area, so you need to put this code to the themes functions.php file:
/ ** * Register an extra area for the search * */ function asp_top_searches_widget_area() { register_sidebar( array( 'name' => __( 'Top searches widget area'), 'id' => 'asp_top_searches_widget', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'asp_top_searches_widget_area' );
Then, this widget area should be visible on the backend (appearance->widgets menu), where you should be able to add the top searches widget now.
I don’t know if this will work, but it’s definitely worth a try.
-
This reply was modified 8 years, 6 months ago by
Ernest Marcinko.
-
This reply was modified 8 years, 6 months ago by
Ernest Marcinko.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 2, 2015 at 3:27 pm #4112Hi,
Thanks for your help. It work but it display in the upper left corner, not below in search box.I have send you FTP and WEB url via email.
Ken
March 6, 2015 at 11:31 am #4133Hi!
It didn’t work, because that function echos the content, and the part where you added was already echoed, so it run twice.
I’ve added the following lines to fix that:
ob_start(); dynamic_sidebar( 'asp_top_searches_widget' ); $asp_plus_sidebar = ob_get_clean();
I see you also wanted to make those keywords white, so I added a CSS rule, because putting them into a paragraph will not help. The following rule is added to the search custom CSS section:
Best,.asp_top_keywords { margin: 0 12px; } .asp_top_keywords a { color: #ffffff; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This reply was modified 8 years, 6 months ago by
- AuthorPosts
You must be logged in to reply to this topic.