Top searches

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 9 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4092
    superman
    superman
    Participant

    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
    Ken

    Attachments:
    You must be logged in to view attached files.
    #4098
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #4112
    superman
    superman
    Participant

    Hi,
    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

    #4133
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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:

    
    .asp_top_keywords {
      margin: 0 12px;
    }
    
    .asp_top_keywords a {
      color: #ffffff;
    }
    
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.