Forums Forums Search & Filter Pro Search results on the same page

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #43064

    Hi,

    I am trying to display results on the same page but that’s not working.

    Display Results: Post Type Archive
    I have selected load results using Ajax

    Upcoming event list should be filtered on the same page based on user’s selection. Please help.

    Regards,
    Garima

    Anonymous
    #43065
    This reply has been marked as private.
    Ross Moderator
    #43071

    Hey Garima

    Ok so the first thing, lets disable ajax completely – much easier for testing.

    Next, you have two options:

    1) The quickest and easiest method for loading results on the same page is to use the shortcode display method:
    http://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/

    This will require your following the instructions to customise the template to create a layout you want.

    2) If you want to use the layout of your homepage and the posts, then you need to make sure your results page layout is the same as the homepage.

    This is your results page:

    http://tinyminygoodness.com/event/

    And it uses a different template to your homepage.

    http://tinyminygoodness.com/

    I’m assuming the results page is also your post type archive for the post type events.

    In this case to change the layout of the events page, you would need to create a new template that follows the template naming structure in WP – https://codex.wordpress.org/Post_Type_Templates

    At a guess it would be archive-events.php if events was the internal name of your post type.

    Once the two pages are matching in layout/design, we can proceed with the next steps.

    Thanks

    Anonymous
    #43951

    Hi Ross,

    I tried to match the layout of my homepage and results page as per your suggestion:

    2) If you want to use the layout of your homepage and the posts, then you need to make sure your results page layout is the same as the homepage.
    Homepage: http://tinyminygoodness.com/
    Results page: http://tinyminygoodness.com/event/

    I have used shortcode to match layout of both the pages. I am not sure if that would work. Please confirm.

    Could you please guide me to the next step.

    Thanks & Regards,
    Garima

    Ross Moderator
    #44108

    Hey Garima

    I changed the ajax selector to:

    .event-posts and I think this is the correct selector – however, currently your results page has a PHP error, so it will not work:

    http://tinyminygoodness.com/event/

    Thanks

    Anonymous
    #44121

    Sorry, I was trying out other methods to display search result. I have reverted my changes. Posts are still not getting filtered. Could you please look at it again.

    Also, could you please give me php code to get value for $query.

    Thanks & Regards,
    Garima

    Ross Moderator
    #44259
    This reply has been marked as private.
    Anonymous
    #44741

    Hi Ross,

    Are you back. Could you please help me with the code to get $query value. I would pass $query to getposttype to retrieve search result.

    Thanks & Regards,
    Garima

    Ross Moderator
    #44980

    Hey Garima

    I took another look.

    So you events archive page – archive-event.php is using a custom shortcode to display the grid.

    Anyway it looks like you will need to create your own query which I guess is what you were asking above.

    To attach S&F to a query, you simple need to add a var.

    So you can do:

    
    $query = new WP_Query(array("search_filter_id" => 1234));
    

    This will setup the query to be used with S&F.

    Then you can loop through the results how you want.

    Hope this is what you were asking for.

    Thanks

    Anonymous
    #45038

    Thanks Ross for the query but it’s not returning correct search result. Could you please check the results page again.

    Many Thanks
    Garima

Viewing 10 posts - 1 through 10 (of 12 total)