WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] releaship between pods (6 posts)

  1. madmikefrog
    Member
    Posted 1 year ago #

    Hi

    Can anyone point me in the right direction. I get set up a pod, display all the fields, but when I try a relationship between a post and (Taxonomy). I can't figure out to display the "related" fields. I have tried $pods->get_field ('houses.garden') which is my related field. The demo video is great, but just I need an example code in version 2. I tried to figure from the early pod 1.x examples. but not getting anywhere. Any help is gratefully received

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Please provide a little more information:

    • Post Type name
    • Taxonomy name
    • Relationship name on Post Type, that relates to taxonomy
    • Is this a relationship field, or are you using the built in taxonomy functionality?
  3. madmikefrog
    Member
    Posted 1 year ago #

    Hi,

    Label, Name,Object type,storage type
    houses, houses, Custom Post type, Meta
    typegardens ,typegardens,Custom Taxonomy,Table

    houses
    Label Label Name Field Types
    field1 home Plain Text
    field2 garden Relationship [type: pick] typegardens (Taxonomy)

    typegardens
    Label Label Name Field Types

    field1 gardentype Plain Text
    garden desc garden_desc Plain

    POD Page
    Page code
    <?php
    $pods = new Pods('houses');
    $pods->findRecords('name ASC', 25);

    while ($pods->fetchRecord()) {
    echo $pods->get_field('home');
    echo $pods->get_field('garden');
    echo $pods->get_field( 'typegardens.gardentype' );
    echo $pods->get_field( 'typegardens.garden_desc' );
    }

    Values in houses is;

    field1 (field1ofhouse)
    field2 drop down (typeofgarden1)

    value in gardentype is
    Name (typegardenfield1)

    field1 (field1gardentype)
    garden desc (field2gardendesc)
    field2

    Screen output is

    (field1ofhouse)ArrayArrayArray
    ?>
    precode

    <?php
    global $pods;
    if (empty($pods->data)) {
    $pods = 404; // Show standard WP 404 page if the item doesn't exist
    }
    $pods = new Pod('houses');

    ?>

    Hopefully that give you the information you need.

    regards

    Mike

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    $garden = $pods->field( 'garden' );

  5. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    You'll also want to be sure you use PHP to loop through the array to output.

    Or you can use this and it will automatically output a list comma-separated for you:

    echo $pods->display( 'garden' );

  6. madmikefrog
    Member
    Posted 1 year ago #

    That's help me out very nicely. Thanks for your time.

    Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic