Support » Plugin: Pods - Custom Content Types and Fields » Prev/Next code

  • Resolved atventure


    I’ve been searching to see if there is a way for the pods to create a Prev and Next link specifically to a category within the same pods post-type. I’ve tried

    [pods name=”PODSNAME” limit=”1″ id=”current” orderby=”previous” where=”LOCATION.slug=’CATEGORY1′.”]


    [pods name=”PODSNAME” limit=”1″ where=”LOCATION.slug=’CATEGORY1′”]

    I am not sure if the id and orderby even accepts the command I’ve placed (amateur here). Not sure what else can be added or exclude.

    The other thing I could do is use the site template’s Prev/Next but it will capture all the post created instead of the specific category.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jory Hogeveen


    Hi @atventure

    You cannot order by “previous” since there is no such thing in the WP database.

    I will point you to the documentation (PHP) about this part of WordPress:

    Keep in mind that this depends on WP_Query, not Pods queries.

    One thing you could try with the shortcode is to sort by date and limit to 1.
    This would result in something like this:
    [pods name="PODSNAME" limit="1" where="LOCATION.slug ='CATEGORY1' AND post_date > 'Current post date'" orderby="post_date ASC"]

    Cheers, Jory

    Thread Starter atventure


    I see, I was trying to set the shortcode so there would be no need to continuously edit for new posts.

    I will try out your shortcode and look into the links provided. Thank you!

    Thread Starter atventure


    Following up with the shortcode: unable to get the

    AND post_date > ‘Current post date'”

    to work.
    I tried the where=”LOCATION.slug=’CATEGORY1′ AND post_date=’yyyy-mm-dd’ ” and outside of where: post_date=”yyyy-mm-dd”. Site was unable to show the shortcode. When it does show, the ascending order is the initial post of the category and the descending order is the newest post of the category and not directly the previous or next of the current post.

    Not sure how else to specify the current post date within the shortcode.

    Plugin Author Jory Hogeveen


    Are you using this code within a Pod template?
    Also, have you checked the query that was made? (Add &pods_debug_sql=1 to your URL).

    Let me know!

    Cheers, Jory

    Thread Starter atventure


    The code was used on the post.

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function PodsData::get_sql(), 0 passed in ...PodsData.php on line 718 and exactly 1 expected in ...PodsData.php:3528 Stack trace: #0 ...PodsData.php(718): PodsData->get_sql() #1 ...Pods.php(2715): PodsData->select(Object(stdClass)) #2 ...plugins/pods/includes/general.php(1057): Pods->find(Object(stdClass)) #3 ...pods/includes/general.php(763): pods_shortcode_run(Array, '<br />\n<a href=...') #4 ...shortcodes.php(343): pods_shortcode(Array, '<b in ...pods/classes/PodsData.php on line 3528

    Plugin Author Scott Kingsley Clark


    There’s a fix for the debug SQL issue in Pods 2.8, I’ll see about getting that fix brought into this next upcoming Pods 2.7.x release.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.