Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Featured posts

Viewing 10 posts - 1 through 10 (of 11 total)
  • David Worth
    #108797

    Hi

    I’m trying to make some (2-3) key products appear at the top of every search and filter. The other search results should appear in alphabetical order by post title.

    Apologies if this is a duplicate post, but I can’t find anything that helps. I’ve several things but with no luck, including Relevannsi.

    Many thanks!

    David

    Trevor Moderator
    #108855

    You would probably want to set up a Custom Field (e.g. in ACF) and make it Boolean (On/Off, True/False) called ‘featured’

    Then change the sort order to have that field sorted first.

    But, beware of two things:

    1. You will have to set a default value for all posts (probably ‘off’) AND edit every post to set this, otherwise any post not so set will disappear from the results completely.

    2. They will still be subject to any filter you make, and might therefore not always appear.

    David Worth
    #108890

    Thanks for the quick response. I have tried this before so gave it another go but still, I can’t get it working.

    Two products are checked as being a ‘Key Product’ but only one is appearing on top and the rest are not sorting alphabetically.

    I have set the Default Order (beneath ‘posts’ tab) to the true/false meta key of field created in ACF and ascending (also tried descending).

    Trevor Moderator
    #108893

    You also set the secondary sort?

    Also remember the 2 gotchas I gave.

    David Worth
    #109039

    Yeah, I set the secondary sort to sort by Title (presume that’s correct – I have played with other options) but then none of the featured posts appears at the top.

    I’ve noted your two gotchas – all posts are appearing on the page, just not in the order I’m expecting.

    I’ve been playing with these for a while and can’t get them working as I think they should be.

    Trevor Moderator
    #109135
    This reply has been marked as private.
    David Worth
    #109224
    This reply has been marked as private.
    Trevor Moderator
    #109438

    OK. I can see you are using a theme template, but I am unable to edit that and see its code content. If you can, open it up and see if you can see where it is passing the query arguments to the wp_query. The theme must be overriding the sort order in our query/filter.

    David Worth
    #109623
    This reply has been marked as private.
    Trevor Moderator
    #109650

    OK.

    So, fresh eyes and I spotted the issue. Three errors. You had Maintain Search Form State On – not a good idea unless you need it. It is now off. You had the wrong meta key name. ACF key names do NOT start with an underscore _. Fixed. The sort order needs to be descending. Fixed.

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

The topic ‘Featured posts’ is closed to new replies.