• Resolved James Adamthwaite

    (@jamesadamthwaite)


    Before I write a novel about how I’m doing it and what’s gong wrong, here’s what I’m trying to do:

    Training courses.
    pod: courses
    pod: registration

    the courses pod list out the courses along with taxonomy and meta. the registration pods are iframe pages to a 3rd party registration system.

    So, I want to have a link on the course page to the associated reigistration page. I’ve got the relationship setup, and the fancy dropdown appears on my course page and I’ve selected the correct registration page.

    Now, to utilize this in a template field, I see that when I call that key, it’s the numerical value of the pageID for the registration pod page. My attempts at producing an anchor link are failing in “Array” — and digginig in I swear it’s a single value… Can’t I just get the direct URL for that registration pod page itself?

    My code:
    <a href="index.php?page_id=<?php echo get_post_meta($post->ID, registration, true); ?>">Register</a>

    Producing: /?page_id=Array

    Thanks in advance! (ps: i’ve looked all over for basic documentation on linking the two pages – or relationships in general)

    https://www.ads-software.com/extend/plugins/pods/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter James Adamthwaite

    (@jamesadamthwaite)

    Plugin Contributor Scott Kingsley Clark

    (@sc0ttkclark)

    If you’re trying to get the registration ID by using:

    <?php echo get_post_meta( $post->ID, 'registration.ID', true ); ?>

    In Pods, relationship fields are returned as arrays of their related data. In Pods 2.3.3 you can now change that to be any of the following:

    • arrays (default)
    • objects
    • ids
    • names

    To change the output type that Pods uses, you can utilize this filter:

    add_filter( 'pods_field_related_output_type', 'change_default_pods_output_type' );
    function change_default_pods_output_type ( $type ) {
        return 'ids';
    }

    By adding that filter, your original code should begin to work. Otherwise, use the modified code I showed above.

    Pods 2.3.3 will be released today.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Relationships: Linking Pages from two pods’ is closed to new replies.