• Resolved ahwitz

    (@ahwitz)


    Using version 2.x of the plugin.

    Forgive me for being a bit new to WordPress in general. I have a custom PHP page that uses the WordPress native get_posts function, and I’m trying to get posts to display on that page in the order that other users have set using this plugin. Is this possible, and if so, what params do I need to put in the get_posts call?

    Couldn’t find any references to this in the FAQ/extant support forum posts, but please let me know if I missed something.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    orgive me for being a bit new to WordPress in general.

    nothing to forgive, we all started somewhere, sometime 🙂

    apologies for the late reply…

    this plugin uses filters (posts_join, posts_where, and posts_orderby) to modify the front-end query for ordered posts and ensure the results are ordered as per your custom order.

    However, get_posts function uses a ‘suppress_filters’ parameter which is set to true by default. You need to explicitly set it to false in your custom queries to ensure you retrieve yours posts in the right order.

    Couldn’t find any references to this in the FAQ/extant support forum

    my mistake. I will add an FAQ for this.

    Thread Starter ahwitz

    (@ahwitz)

    I’d tried your suggestion after you got back to me and couldn’t get it to work; found https://wordpress.org/support/topic/not-working-with-get_psots/ and your…

    > make sure you have enabled manual sorting by selecting the ‘Yes’ radio button in the edit screen, else the front-end query filters will not execute.

    …suggestion made it work. Thanks a ton!

    Thread Starter ahwitz

    (@ahwitz)

    Actually, I take that back: Occasionally we’re getting a javascript TypeError when using the click-and-drag interface.

    Best I can give you is:

    “Cannot read property name of null at readFile (content.js:26); at HTMLDocument.<anonymous> (content.js:86)”.

    I can’t really send you this data and it’s on a protected site. Let me know if I can give you more information.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Actually, I take that back: Occasionally we’re getting a javascript TypeError when using the click-and-drag interface.

    Best I can give you is:

    “Cannot read property name of null at readFile (content.js:26); at HTMLDocument.<anonymous> (content.js:86)”.

    where is this file content.js located?

    Thread Starter ahwitz

    (@ahwitz)

    That’s a very good question – I’d expected it’d be yours, but it definitely doesn’t seem to be, and I can’t reproduce it anymore.

    Now, every time I change things, then reload the page, they come back in a seemingly random order. Definitely not the one I last had, and definitely not what it was before. “Use the manual sorting” is set to “Yes”, and I’ve tried resetting.

    One of our staff members also reports that some categories are maintaining her requested order, and reports that “Reordering works for categories that I have never tried to reorder before.” – this may be “never tried to reorder” and may also be related to our upgrading from v1 to v2.

    Honestly have no idea how to debug this. I do have direct DB access if there’s any queries I can run to get you more information.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I’d expected it’d be yours, but it definitely doesn’t seem to be, and I can’t reproduce it anymore.

    hehe, not that I know of…hence the question. Your console doesn’t link the file to its path?

    One of our staff members also reports that some categories are maintaining her requested order, and reports that “Reordering works for categories that I have never tried to reorder before.” – this may be “never tried to reorder” and may also be related to our upgrading from v1 to v2.

    oh! That’s very odd. Could you get in touch on vrata at syllogic dot in

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Honestly have no idea how to debug this. I do have direct DB access if there’s any queries I can run to get you more information.

    a couple of other users are also reporting strange behaviours. The previous version of this plugin was using an INNER JOIN sql parameter to filter posts queries on the front end and order them using the custom table rank for each posts.

    I have a feeling the INNER JOIN clashes in v2 as the rank is now stored in the postmeta table. So I would like to test a simple JOIN or possibly a LEFT JOIN to see if this fixes the issue.

    So if you could reach out to me on vrata at syllogic dot in then we could explore the issue on your setup and try to nail down this issue.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Accessing order in custom `get_posts` call?’ is closed to new replies.