Forums › Forums › Search & Filter Pro › Search results on the same page
- This topic has 11 replies, 2 voices, and was last updated 9 years, 8 months ago by
Ross.
-
Anonymous(Private) April 18, 2016 at 11:10 am #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 AjaxUpcoming event list should be filtered on the same page based on user’s selection. Please help.
Regards,
GarimaRoss Moderator(Private) April 18, 2016 at 11:47 am #43071Hey 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.
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.phpifeventswas 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(Private) April 26, 2016 at 12:59 pm #43951Hi 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,
GarimaRoss Moderator(Private) April 27, 2016 at 11:19 am #44108Hey Garima
I changed the ajax selector to:
.event-postsand 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(Private) April 27, 2016 at 11:55 am #44121Sorry, 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,
GarimaRoss Moderator(Private) May 7, 2016 at 5:31 pm #44980Hey Garima
I took another look.
So you events archive page –
archive-event.phpis 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
-
AuthorPosts