Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this [untested]:

    <?php
    $credits = get_post_meta($post->ID, 'credits', true);
    if ($credits != ''  ) : ?>
            <aside class="credits">
              <?php echo apply_filters('the_content', $credits); ?>
            </aside>
            <?php endif; ?>

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Ignore the above, I got myself in a pickle. The code below works ok.

    <?php if( $credits = get_post_meta($post->ID, 'credits', true) ): ?>
            <aside class="credits">
              <?php echo apply_filters('the_content', $credits); ?>
            </aside>
    <?php endif; ?>
    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Thanks Keesiemeijer, it seems your code works as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Only display custom field if present and add content filters’ is closed to new replies.