• Resolved gighen

    (@gighen)


    hi,
    i made a custom query to filter and order by custom fields, but actially post are still ordered by date, i can even reverse the order adding DESC, but only but date also if the ORDER BY field is not the post date, it’s a priority custom field …. so why??

Viewing 6 replies - 1 through 6 (of 6 total)
  • MichaelH

    (@michaelh)

    You might post your code at https://wordpress.pastebin.ca/ and report the link back here so others can see the actual problem.

    Thread Starter gighen

    (@gighen)

    ok, this is my code
    https://wordpress.pastebin.ca/759558

    it’s pretty much a cut&paste from the codex

    MichaelH

    (@michaelh)

    Works just fine for me.

    Make sure you create a Page and assign mypriority as the Page Template to that Page.

    Thread Starter gighen

    (@gighen)

    hi Michael,
    thank you for your test, but i still get a wrong priority order such:
    10 > 2 > 4 > 9 … that’s pretty amazing becuse doesn’t event seems to be a date order :-/

    i found around some indication about Template hierarchy, but it doesn’t matter with my case, i just apply a template to a page ??

    can i see your test working?
    thank you

    Kafkaesqui

    (@kafkaesqui)

    1(0) will show before 2 (if this is what you are reporting the query to be doing); ORDER BY will provide a sort order based initially on the first character, and 1 comes before 2.

    Try changing your values for single numbers to 02, 04, etc.

    Thread Starter gighen

    (@gighen)

    grrr… so easy ??
    it seems work, thank you ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘“order by” not working’ is closed to new replies.