Site logo

[Resolved] Custom “order by” prevents Query Loop form loading in backend

Home Forums Support [Resolved] Custom “order by” prevents Query Loop form loading in backend

Home Forums Support Custom “order by” prevents Query Loop form loading in backend

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #2302618
    Fernando
    Customer Support

    In your site, where can we specifically find the Query loop block?

    #2302619
    Alessandro

    There’s one on the About page and on the Homepage (same block)

    #2302623
    Fernando
    Customer Support

    To clarify, by “it” not working, do you mean that the Query isn’t ordering as expected, or are you referring to it still appearing “no results found” in the editor?

    #2302624
    Alessandro

    Sorry, I meant the “No results found” error. The query itself has always worked fine, it’s just not editable in Gutenberg unless I temporarily change the sorting to some other method than “menu order”. Not a huge problem.

    #2302629
    Fernando
    Customer Support

    That’s odd, I tried viewing the edit page from my end, and I couldn’t replicate the issue. The Query loop block is showing results.

    Can you try viewing from a different browser or device? Might be a cache/device issue or a WordPress glitch.

    #2302631
    Alessandro

    I had removed Menu Order just now (for testing). I added it back – you can see the problem persists. It’s OK if we can’t resolve this, I thought I was missing something obvious but I understand the PHP function is not standard.

    #2302635
    Fernando
    Customer Support

    I see. As Ying mentioned, “As menu order is for pages usually, even we use the code to add it to the posts editor in admin, but the function that generates the preview of GB query loop doesn’t know.”

    Using the function I provided is an alternative if you want the order setting, and still see the posts in the editor.

    #2302637
    Alessandro

    The provided function still causes the same problem though. It’s currently active on the dev site.

    #2302648
    Ying
    Staff
    Customer Support

    You need to remove the order by parameter from the query loop blocks.

    And I’m not seeing the class has been added to the query loop block, nor the function that Fernando provided in your child theme.

    #2302649
    Alessandro

    If I do that the blocks become visible in Gutenberg, but the ordering does not work correctly. Maybe I added that CSS class incorrectly?

    Edit:

    And I’m not seeing the class has been added to the query loop block, nor the function that Fernando provided in your child theme.

    It is there.

    #2302654
    Ying
    Staff
    Customer Support

    If I do that the blocks become visible in Gutenberg, but the ordering does not work correctly

    I was checking the home page, it seems you’ve added the class to the about page.
    Is this the correct order?
    https://www.screencast.com/t/3CGLgjh4

    #2303083
    Alessandro

    Oh yes sorry, it was indeed the About page. And no, the order is not working. Stacey should be last in the list.

    #2303453
    Ying
    Staff
    Customer Support

    Hum, I’m not seeing Fernando’s code, it seems you are still using the original code:
    https://www.screencast.com/t/Vmbz2k1C2h

    #2303455
    Alessandro

    Oops, I must have reverted back to the previous function… it is working now! Thank you!

Viewing 14 posts - 16 through 29 (of 29 total)
  • You must be logged in to reply to this topic.