• Resolved morris373

    (@morris373)


    Hi
    I am struggling to output anything, I am getting confused and I feel I am going backwards.

    I have a Clergy Pod and a Taxonomy called Clergy Role. Clergy Role has values, Curate, Dean, Vicar, Rural Dean and Canon.

    On the Clergy’s page, I add the name and select the Clergy Role. My problem is getting this value in a PHP page template. I am not using the Shortcode method or a Pod template.

    How can I get these values?

    Morris

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

    (@keraweb)

    Hi @morris373

    You can use the Pods object or use WordPress’s core functions:
    get_post_meta():
    https://developer.www.ads-software.com/reference/functions/get_post_meta/

    For Pods functions see: https://pods.io/docs/code/pods/display/
    Sorry about the older documentation page, this part isn’t migrated yet.

    Personally I prefer to use WordPress’s core functions are these will always be valid.

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi Jory
    I have tried:

    $clergy_role = get_post_meta( $id, 'name', $single=true);

    $clergy_role = get_post_meta( $id, 'clergy_role', 'name', $single=true);

    $clergy_role = get_post_meta( 'clergy_role', 'name', $single=true);

    Can’t get anything to work.

    Reverend Robert Williams

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @morris373

    That is because the code you are using is incorrect. Please read the WordPress documentation thoroughly (this isn’t Pods anymore, it’s WordPress and general PHP code).
    Also see the user contributions/examples: https://developer.www.ads-software.com/reference/functions/get_post_meta/#user-contributed-notes

    You cannot pass a variable with an assignment like $single=true. You should just use true.
    Also, did you properly get the ID of the object you are trying to fetch the field from?
    Something like get_the_ID() if you are in a loop.

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi
    This is why I am confused, I’m use to doing it 1 way and whilst using Pods, I have been shown another way.

    No doubt the code has come from your Pods documentation, even the code in the table has a typo so very confusing. That is my next nightmare to solve as I am getting no records back when there’s 14 in the database.

    $clergy_role = get_the_term_list( $post->ID, 'clergy_role', '', '', );
                        $clergy_role = strip_tags( $clergy_role );

    This is how I got the term associated with a Taxonomy on my other main website. The extra line removes the link as I don’t need it.

    Morris

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get the Taxonomy’ is closed to new replies.