Forums Forums Search & Filter Pro Order post by custom taxonomy

  • This topic has 39 replies, 3 voices, and was last updated 7 years ago by Ross.
Viewing 10 posts - 1 through 10 (of 40 total)
  • Anonymous
    #112502

    Hi there!

    I’ve got a question: how can i order the results by a custom category? Every post has applied a custom taxonomy, and i need to give the results based on that taxonomy.

    I can’t find nothing similar in the Posts> Default order tab.

    Any help?

    Thank you very much!!!

    Trevor
    #112512

    As there can be multiple taxonomy terms per post, which one would it use for the sort? This is the reason why. If you used a single value Custom Field (Post Meta), you could use that.

    Anonymous
    #112592

    Oh, you’re right! Im my case i’m sure a post will be only in a taxonomy term. So if i could order by custom taxonomy it will work as i expected.
    Can i set a custom query somehow with your plugin?

    Thank you Trevor!

    Trevor
    #112602

    It will not sort by taxonomies, as it is not in the code of the plugin. I do not know if you could do it using this, and I have no idea how you would:

    https://www.designsandcode.com/documentation/search-filter-pro/action-filter-reference/#Edit_Query_Arguments

    Anonymous
    #112621

    I’m going to check it. Thank you again!!

    Anonymous
    #113608

    Hi again!

    I’ve finally changed to ACF field avoiding the custom taxonomy to ordering my posts. But now i’ve a strange behaviour: The results doesn’t respect the title of the ACF option

    Strange behaviour

    Why is “Hormonales” before “Antibióticos”, and why is “Antibióticos” before everything else when the right order is the same show it at the sidebar controls (actually i think there is another bug, because “Óticos” is in the last position instead in the “O” group, but i think this is because the accent maybe?).

    Help please, what i’m doing wrong here?

    Anonymous
    #113616
    Trevor
    #113636

    Sort order depends on the ‘collation’ that your WordPress mysql database is using. You should choose one suited to your language, otherwise the sort order may well be wrong for any accented characters. You can see what it is using if run install and run the ARI Adminer plugin in WordPress, or use PHPmyAdmin.

    Anonymous
    #113638

    So, the unordered results list (not the control list) could be affected by the ‘collation’ too? I would like to be sure before to tell the sysadmin to check it 🙂

    Thank you Trevor!

    Trevor
    #113640

    It depends on whether a sort is made at any point. I am uncertain what the default order would be, but if it is alphabetical, then yes.

    Another user had much the same problem. I cannot recall what the ideal one is. I know that WordPress itself moved to the utf8mb4 … series a while ago, but some databases still use the utf8 … series.

    For example:

    utf8mb4_general_ci
    utf8mb4_unicode_ci
    utf8mb4_swedish_ci

    Whatever is set in the database, PHP and mySQL then use that for the sort order.

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