Forums Forums Search & Filter Pro Append post above search results

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #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
    #197456

    It 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?

    Trevor
    #197458

    I forgot to add …

    Please note that we are now into a holiday period in the UK. We will be working for some of this period, but replies may be delayed at times.

    Anonymous
    #197477
    This reply has been marked as private.
    Anonymous
    #197633

    Hey 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!

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