Forums › Forums › Search & Filter Pro › Append post above search results
- This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago by Anonymous.
-
Anonymous(Private) December 23, 2018 at 4:52 am #197419
Hi team,
I’m looking to add a post to my query results, but conditionally based on a filter result, do you know if there’s a way to do this?
e.g. i have four filter criteria, if the first criteria is filtered on, a post corresponding to that would be displayed, that would not show up in the regular results otherwise.
Trevor(Private) December 24, 2018 at 10:45 am #197456It should be possible, but it would require coding to translate your idea into PHP that would work. Is this something you, or a third party you might hire, are willing to do?
The way that you would do this depends to an extent on the filters your are using in the search and the Display results Method, but in all cases it would require you to be using a child theme and to edit the PHP template file to add the code to determine what filters are being used, and you might also need to add a second wp_query so that you can show the additional post, or you might need to edit our filter query arguments.
Would the additional post be somewhere in the results, or first (before all others), and if so, does it need to appear on all pages?
Anonymous(Private) December 29, 2018 at 7:37 am #197633Hey Trevor, stick with the holidays, we’ve managed to implement a solution.
Two controls on the page, one hidden (as archive type), and some javascript setting the hidden control to the same value as the visible one (as custom type) on change.I did have an issue with the ajax container, it was very selective about what ID I could use.
The custom type was destination #content and was working, i put a div (#contenthist) above it for the hidden control and it wouldnt work, though if i redirected it to #content it was OK.
I ended up renaming #content to #content1 and #contenthist to #content and both are working fine – was very strange, wouldnt mind knowing why but it’s not pressing for me now.Cheers!
-
AuthorPosts