Forums Forums Search & Filter Pro Search results for ""

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #178683

    Hi,

    The plugin works is working on my site and with my theme (Soledad). However, on the search return results page it does not include the search term in the title so the page is titled:

    Search results for “”

    with the content below – see screenshot here: https://www.dropbox.com/s/udy8v54eyvmm9zd/Screenshot%202018-05-21%2010.50.19.png?dl=0

    Is there any way to get the search term showing in the search return page so that the title looks right?

    Thanks,

    Matthew

    Trevor
    #178718

    Accessing and using the Search Data can be complex of your form is complex, however, this documentation page will start you off:

    https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/

    Anonymous
    #180060

    Hi Trevor,

    Thanks for your help with this. It looks like the code I need to use is:

    Get the Search Term
    <?php
    //Get the search term
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1526)->current_query();
    echo $sf_current_query->get_search_term();
    ?>

    However, I’m not clear where I should be inserting this in the theme – should I be looking for the search.php template file and inserting it in there where the searched terms are shown?

    Thanks,

    Matthew

    Anonymous
    #180062

    If it helps, this is the title bar for my search return page:

    <div class=”title-bar”>
    <span><?php echo penci_get_setting( ‘penci_trans_search_results_for’ ); ?></span>
    <h1><?php printf( esc_html__( ‘”%s”‘, ‘soledad’ ), get_search_query() ); ?></h1>
    </div>

    Trevor
    #180071

    This part:

    <?php printf( esc_html__( ‘”%s”‘, ‘soledad’ ), get_search_query() ); ?>
    

    Needs to be replaced by the code you quoted.

    Anonymous
    #180786

    Okay, thanks for that. I’ve fixed that now.

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