Support » Plugin: Pods - Custom Content Types and Fields » Custom list with two pods ands relationships

  • Resolved dionysos73

    (@dionysos73)


    Hello,

    first, you have done a really good job with that great plugin. I will try to explain what i want to do because i’m such a poor php coder :/

    For my blog, i want to create a band’s discography with some information about their albums. For that, i need to create in particular the tracklist for each album.
    I have two pods: albums and songs with a relationships between fields tracklist (for albums pod) and from_the_album (for songs pod). I have done this bidirectionnal field because I want to link each songs of the tracklist to another page with informations about the song (as lyrics).

    i have succeeded to display the songs for an album but the output result seems like this:

    track 1, track 2, track 3, …, and track x.

    I want something like this:

    1. track 1
    2. track 2
    3. track 3

    Did you have some example of code to do something like this, i’m a bit lost…

    Thanks for you help.
    Regards,
    Denis

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    You could use PHP:

    <?php
    $tracks = $obj->field( 'tracks' );
    
    if ( !empty( $tracks ) ) {
    ?>
    <ol>
        <?php
            foreach ( $tracks as $track ) {
        ?>
            <li><?php echo $track[ 'name' ]; ?></li>
        <?php
            }
        ?>
    </ol>
    <?php
    }
    ?>
    Thread Starter dionysos73

    (@dionysos73)

    Thank you so much for you help Scott…

    regards,

    Denis

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom list with two pods ands relationships’ is closed to new replies.