Custom Fields Preference (2 posts)

  1. Matt Mullenweg
    Posted 12 years ago #

    For custom fields in posts, to display in the template would you rather have something like:
    Option 1:

    <?php if (post_custom('listening')) { ?>
    Yo! I'm listening to <?php echo post_custom('listening'); ?> and it's tight!
    <?php } ?>

    Option 2:

    <?php post_custom('Yo! I\'m listening to % and it\'s tight!', 'listening'); ?>

    The second is less verbose, but you have to escape stuff, the first is more flexible, but more verbose. Thoughts?

  2. KAShirow
    Posted 12 years ago #

    I vote for the first option. It makes more sense.
    Why don't you code a wrapper function to make the first behave like the second?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.