Support » Plugin: Pods - Custom Content Types and Fields » Shortcode: Display a field from the latest post of single Pod item

  • Resolved davejhinton

    (@davejhinton)


    I am using this shortcode to display a field from a single pod item in my page.

    [pods name=”my_pod_name” slug=”my_pod_slug” field=”my_field”]

    However I am going to use Postie to create a new post with updated data from CRM on a daily basis. I would like this shortcode therefore to display a field from the latest post of single Pod item as opposed to the one I identify by the ID. Now I am a novice so I tried the following without success.

    [pods name=”my_pod_name” where=”latest-selected-content” field=”my_field”]

    I’m hoping there is an easy answer for this…

    Thanks in advance!

    • This topic was modified 4 months, 1 week ago by davejhinton.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @davejhinton

    I believe by default the query always orders by date so you can just add a limit=1 param instead of the slug or where param.
    Otherwise you could always add a orderby param.
    More info here: https://docs.pods.io/displaying-pods/pods-shortcode/

    Cheers, Jory

    Thanks for your reply Jory,

    So I have tried…

    [pods name=”my_pod_name” limit=1 field=”my_field”]

    [pods name=”my_pod_name” limit=”1″ field=”my_field”]

    And neither returned the field from the latest post.

    I’m not sure how to add an orderby param. I tried versions of the following…

    [pods name=”my_pod_name” ordeby=”post_date =’today'” field=”my_field”]

    Without success.:(

    Plugin Author Jory Hogeveen

    (@keraweb)

    [pods name=”my_pod_name” ordeby=”post_date =’today’” field=”my_field”]

    ordeby should be orderby
    – The value should be valid SQL: t.post_date DESC for example

    Cheers, Jory

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