Support » Plugin: Pods - Custom Content Types and Fields » How to get ID page/post

  • Resolved Dave

    (@airdaveit)


    Hi everyone, I’m trying to recover the ID of the page that is associated with the list of publications by author.

    this is the shorcode

    [pods name=”publications” limit=”20″ orderby=”editions DESC” template=”publications list” where=”people.id = {@ID}”]

    {@ID} won’t get me the page / post id

    how can I recover via get_id () and insert it in the where clause of my shorcode?

    Thanks

    sorry for my english

    • This topic was modified 10 months, 3 weeks ago by Dave.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Did you add the wp-config.php changes advised in the Special Magic Tags documentation (https://pods.io/docs/build/special-magic-tags/)?

    You have to add define(‘PODS_SHORTCODE_ALLOW_EVALUATE_TAGS’,true); to your wp_config.php for these tags to be used.

    Thread Starter Dave

    (@airdaveit)

    Hi, Jory Hogeveen
    thanks for your answer,
    yes I had already included it in the wp-config.php, but I had no result.

    If I call {@ID} in the pods templates I see it and it works correctly, but in the where clause in the shortcode no.

    it certainly returns the IDs of the publications but not of the page / post

    I don’t understand where the problem may be.

    Thankyou
    Dave

    • This reply was modified 10 months, 3 weeks ago by Dave.
    Plugin Author Jory Hogeveen

    (@keraweb)

    Did you check the SQL it generates?
    people, is that a field? If so, you should probably use people.meta_value

    Thread Starter Dave

    (@airdaveit)

    The people field is a bi-directional field relationship with other People pods.
    People is a multi select.

    The People page includes the list of publications.
    A publication belongs to multiple People.

    The where clause indicates the ID reference by ID of the author page in the publications of the single People.

    If I use the fixed numeric ID, (test mode)
    where = “people.id = ‘8928’” I get the result.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Are you using the shortcode in Pods Templates or within the page content??

    Thread Starter Dave

    (@airdaveit)

    Hi Jory,
    I am using the shortcode in page content.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Ah right! Nope, then the magic tags will not work.
    This however would be a good improvement for Pods.
    Currently Pod object related magic tags only work in Pods Templates.

    I’ve made a report on GitHub: https://github.com/pods-framework/pods/issues/5734

    Cheers, Jory

    Thread Starter Dave

    (@airdaveit)

    Great Jory,
    thanks for your help.

    Following…

    Thread Starter Dave

    (@airdaveit)

    Hi Jory,
    i read the chanlog and in the new 2.7.23 release this is fixed.
    Do you agree?

    Added / Fixed: Support Pod related magic tags in shortcode query parameters. # 5734 (@JoryHogeveen)

    Are there any updates in the guides on how to assign the post id?

    Thanks for your help

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @airdaveit

    See the example in the GitHub issue: https://github.com/pods-framework/pods/issues/5734

    If you are using magic tags through a shortcode it will first run these through the Pod object the shortcode refers to.

    Cheers, Jory

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @airdaveit

    Problem fixed in the new release.

    Cheers, Jory

    Thread Starter Dave

    (@airdaveit)

    Hi @keraweb
    thanks for the assistance and technical support!
    The problem appears to be solved.

    Cheers,Dave

    Plugin Author Jory Hogeveen

    (@keraweb)

    You’re welcome! The best way to say thanks is to leave a 5 star review at https://wordpress.org/plugins/pods/ and (if you’re feeling especially generous) become a Friend of Pods at https://friends.pods.io/

    Cheers, Jory

    ciao Zio Dave, come posso contattarti in privato per un problema? Ciao Paolo

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