WordPress.org

Ready to get started?Download WordPress

Forums

Custom Fields Preference (2 posts)

  1. Matt Mullenweg
    Troublemaker
    Posted 10 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 } ?>

    OR
    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
    Member
    Posted 10 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

Tags

No tags yet.