Home Forums General Issues Relationship Code Problem Reply To: Relationship Code Problem

    • homax

    • July 23, 2013 at 4:38 pm


    sure I wan’t to explain it more detailed.

    I have got a category where now 4 articles should be listed. On every article I would like to display via the relationship the title of an other article which is connected via the relationship.

    For displaying the title I use this code snipped

    <?php $posts = get_field('myfieldname');
    if( $posts ): ?>
    <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
    <?php setup_postdata($post); ?>
    "><?php the_title(); ?>
    <?php endforeach; ?>
    <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>

    The title would be displayed perfect.

    But the other 3 Postings in this category won’t be published. Only the first article will be showen in the category. All articles which will be listed after the relationship snipped won’t be showen.

    Have you got any idea?

  • We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.