WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Custom list with two pods ands relationships (3 posts)

  1. dionysos73
    Member
    Posted 11 months ago #

    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/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 11 months ago #

    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
    }
    ?>
  3. dionysos73
    Member
    Posted 11 months ago #

    Thank you so much for you help Scott...

    regards,

    Denis

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.