• Resolved Morklympious

    (@morklympious)


    http://pastebin.com/ZurgaVpa

    Hello again!

    So, above is the code I’ll be referring to, but basically, the wordpress I’ve been working on has been playing nice with Pods as of late.

    I’m running the most recent version of both, and while I don’t have many problems, this one leaves me stumped:

    So, Posts in the WordPress I’m working on have an extension via pods for a checkbox called “The Next Big Thing”, and it’s setup in such a way that I have PODS query all posts, and find the most recent post with the “Next Big Thing” checkbox checked!

    Now, my issue is that this works FINE until the most recent post is past 15. Meaning it’s the 16th most recent post.

    At that point, the title of the article that has that checkbox doesn’t show up on the frontpage like it should, instead nothing displays, so it leads me to believe that PODS is only querying 15 posts by default?

    Either I’m using the documentation wrong or I just haven’t used querying parameters correctly.

    I’ve tried ‘showposts’, ‘postsperpage’, etc. If anyone can point me in the right direction I’d appreciate it!

    http://ww.wp.xz.cn/extend/plugins/pods/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    First, since you’re using posts, you should consider using this instead, as it’s easier and more documented for your purposes:

    http://codex.ww.wp.xz.cn/Class_Reference/WP_Query

    Second, here’s your code tweaked a bit more for optimal use based on your function needs:

    http://pastebin.com/6VHky5Px

    The default ‘limit’ is set to 15, so you could set it to 'limit' => -1 to do all records. For your needs, you want the latest t.post_date DESC and just the first 'limit' => 1

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Additional details about find() and how it works (you’ve called the shortcut, pods( 'podname', $find_params ) but it’s the same parameters):

    http://staging.pods.io/docs/code/pods/find/

    That’s a page on our new docs area, we’re about to launch it soon.

    Thread Starter Morklympious

    (@morklympious)

    Okay, so my understanding of this is that since I’m querying posts with a pods function, the ‘t.’ is syntax to select from the database, and we’re selecting the post_date field in DESC order, so newer posts first.

    Limit is just how many records are returned, correct? so if I had limit set to 2, it would return the two most recent posts that had the ‘next_big_thing’ checked?

    And then the ‘where’ field is just a part of an SQL query that looks for the value of 1 in the next big thing attribute?

    You can go ahead and mark this as resolved, it fixed the issue, but I wanted to make sure I understand whats happening here so I can document it and better work with pods in the future.

    Thanks, Scott. You’re a hero!

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Right, everything you’ve stated is exactly what each of those things do.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Issue with querying pods objects for a checkbox’ is closed to new replies.