1. Mark says

    Hey Shawn,

    I’m a new WP101 subscriber today so…. A couple of questions all at once if I may please. And please let me know if multiples of questions should go in future into seperate posts.

    Can one add multiple variables to a Meta Key? Such as Key:Mood Value: Happy, Sad, Elated
    And if so how does one select the varaiable so that it shows? One might have a variable of mood or price, eh.

    Once I have added the .php code as you showed, can I select the Meta Key to show across each new post as I create them or do I need to add the .php each time? Do I add that meta with %mood% Happy or %Price% £599 for instance.

    I’ve grabbed Cark’s excellent looking book so feel free to direct me to

    And thanks in advance for what looks like a great resource.

    Yours in staring down the rabbit hole of wanting to know more.
    Mark Muggeridge

    • says

      Welcome to WP101, Mark!

      Questions about specific videos are welcome in the comment field below each video, but for other questions not specifically related to the video, feel free to post them in the members-only Q&A Forum.

      While you can certainly add multiple *values* to a single meta key, it’s typically not a good practice. Rather, once you’ve created a meta key, new values are added each time you enter a new one in the field, and those values are then available for use in future meta keys. Key values are saved per post, so each post will only display the values entered in the field(s) for that particular post.

      The PHP that you’ll insert into your theme file will simply show the value of the meta key as entered for that particular post. So you’ll only add that PHP code to your theme file once.

      No doubt Clark’s book will answer your questions in more detail.

      Hope this helps!

  2. Mark says

    Hey Shawn, (Again)

    Wow, I’ve leant a lot today in a short period of time using your site.

    Like; I can’t use markdown in a question. (Which is fine as I was just putting stuff in brackets for empasis.)
    and reading Clark’s book I think I have found answers to my own questions.

    So I now understand using If:Else when adding .php for custom fields. This answers my question about how the content gets added to the post. (And More)

    And I guess once I have created a key: Being that I add the variable on the post page – that changes the variable for that instance?

    One final question then….How do I position the output? I can see that adding the .php to _post puts it at the bottom of the post – but what it I wanted to put it in the middle of the post – for some odd reason?


    • says

      Hi Mark,

      Glad to hear you’re learning so much in a short time. Makes my day!

      You’re right; by default, WordPress supports limited HTML in comments, not Markdown. But our Q&A Forum *does* support Markdown. :)

      You’re right… once you’ve entered a value for a meta key on a particular page, it’s set for that instance (that post) only.

      It’s a bit tricky to retrieve and display a meta value *within* the content of a post. In reality, this would rarely be needed, as you’re more likely to want to display the meta value either before or after the content of a post.

      The easiest way to display a meta value within the content of a post — and be able to determine precisely where it appears within your content — is to create a shortcode that retrieves and displays the meta value.

      For example, you might create a shortcode called: [mood] and then simply enter that shortcode wherever you want that meta value to appear.

      Shortcodes are created by inserting a bit of code within your theme’s functions.php file. Read more about creating shortcodes here:

      Even easier, you might try the “Meta Shortcode” plugin, which will display the contents of a custom field anywhere in your post:

      Hope this helps!