1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to display Your Mood Or Music You’re Listening To On WordPress

Discussion in 'Help, Niches & Tutorials' started by Andy, Nov 28, 2017.

Loading...
Tags:
  1. Andy

    Andy Vip Member Vip Member

    Messages:
    146
    Likes Received:
    90
    Trophy Points:
    44
    What this feature doez is it allows users to display their current mood and the music they were listening to while blogging.
    Even though I wouldn’t use this feature on my blog, I figure many bloggers would be interested in knowing how to do this in WordPress.
    lets role.....Open your single.php file (or modify your index.php file), and paste the following code anywhere within the loop:

    Code:
    $customField = get_post_custom_values("mood"); if (isset($customField[0])) { echo "Mood: ".$customField[0];
    }
    
    Save the file. Now, when you write a new post, just create a custom field called mood, and type in your current mood as the value.

    Note:This is a very basic use of custom fields, not all that different from the well-known hack for displaying thumbnails beside your posts’ excerpts on the home page. It looks for a custom field called mood. If the field is found, its value is displayed.
     
    Last edited: Dec 8, 2017

Share This Page