WordPress.org

Support

Support » Plugins and Hacks » Custom Content Type Manager » [Plugin: Custom Content Type Manager] List of related posts in main post

[Plugin: Custom Content Type Manager] List of related posts in main post

Viewing 1 replies (of 1 total)
  • Plugin Contributor fireproofsocks

    @fireproofsocks

    Exactly how you do this depends on how you have defined your relation fields. Let’s say for example that you have a repeatable relation field named “pets” that’s used by the “owners” post-type. Your code inside single-owners.php might look something like this:

    <?php
    
    $pets = get_custom_field('pets:get_post');
    foreach($pets as $p) {
        print '<a href="'. print $p['permalink']; .'">'. print $p['pet_name'] . '</a><br />';
    }
    
    ?>

    The above example assumes that each pet has a custom field named “pet_name”. If the pet’s name is stored as the post-title, then you’d print $p[‘post_title’] instead.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Custom Content Type Manager] List of related posts in main post’ is closed to new replies.
Skip to toolbar