General search function not working

Forums › Forums › Search & Filter Pro › General search function not working

Viewing 4 posts – 11 through 14 (of 14 total)
  • Anonymous
    #157375

    Hi Trevor,

    Thanks for the quick response.

    I can get it to half work… This search query should yield the response:
    “Search Results for: green Brexit, Legatum Institute, Posts”
    http://smartthinking.staging.wpengine.com/?sfid=979&_sf_s=green&_sft_category=brexit&_sfm_think_tank=Legatum%20Institute&post_types=post#a

    At least that is what I would like it to do. But currently only the category is showing.

    This is the markup:

    <?php
        global $searchandfilter;
    	$sf_current_query = $searchandfilter->get(979)->current_query(); ?>
                        
                
        <h1 class="archive_title"><span><?php _e("Search Results for","wpbootstrap"); ?>:</span> <?php echo esc_attr(get_search_query()); ?>
                            
             <?php              
            $args = array(
                "str" 					=> '%2$s', 
                "delim" 				=> array(", ", " - "), 
                "field_delim"				=> ', ', 
                "show_all_if_empty"			=> false 
            );
            
            echo $sf_current_query->get_fields_html(
                array("_sft_category", "_sft_post_tag", "_sft_sfdc_post_type", "_sft_sfdc_think_tank"), 
                $args
            );
            ?>
            
        </h1>

    Have I done something wrong?
    Thanks,
    Alex

    Trevor
    #157381

    You might need this for what is in the search box:

    $search_words=$sf_current_query->get_search_term();

    and then echo that. If you search our forum:

    https://support.searchandfilter.com/forums/search/sf_current_query/

    You will see many different examples of use.

    Anonymous
    #162430

    Hi Trevor,

    I didn’t quite manage to get that working in the end… but I have a separate question, hopefully more straightforward.

    Is there a setting to make the general search look in the tags?
    I.e, if I tag a post with ‘digital’, but there is no mention of the word in the title or content, but then if I search for the word ‘digital’ in the general search box, I’d like that post to show.
    ?

    Thanks,
    Alex

    Anonymous
    #162432

    Problem solved with Relevanssi!

Viewing 4 posts – 11 through 14 (of 14 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.