This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Top searches

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4092
    supermansuperman
    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

    #4098
    Ernest MarcinkoErnest 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):

    [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.

    #4112
    supermansuperman
    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 MarcinkoErnest 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:
    [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]

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.