Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Top searches
- This topic has 3 replies, 2 voices, and was last updated 11 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 1, 2015 at 3:45 pm #4092
superman
ParticipantHi,
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
KenMarch 2, 2015 at 12:05 pm #4098Ernest Marcinko
KeymasterHi!
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):
[code]
7 <div style="margin:10px" >’.do_shortcode(‘[wpdreams_ajaxsearchpro id=4]‘).'</div>
8 <div> ‘.dynamic_sidebar( ‘asp_top_searches_widget’ ).’ </div>
9 </div>’;
[/code]and, you will need to initialize that widgetized area, so you need to put this code to the themes functions.php file:
[code]/
**
* 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’ );
[/code]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 11 years, 3 months ago by
Ernest Marcinko.
-
This reply was modified 11 years, 3 months ago by
Ernest Marcinko.
March 2, 2015 at 3:27 pm #4112superman
ParticipantHi,
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 #4133Ernest Marcinko
KeymasterHi!
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:
[code]
ob_start();
dynamic_sidebar( ‘asp_top_searches_widget’ );
$asp_plus_sidebar = ob_get_clean();
[/code]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:
[code]
.asp_top_keywords {
margin: 0 12px;
}.asp_top_keywords a {
color: #ffffff;
}
[/code] -
This reply was modified 11 years, 3 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.