Post Pic

How to: Display your current mood on your posts

Did you used to be a Live Journal member some years ago? I remember that when you wre writting a post, you were asked for your mood, which will later be displayed on your blog. Here is how to recreate the same functionnality under WordPress.

Open your single.php file (You can also modify your index.php file) and paste the following code anywhere within the loop:

$customField = get_post_custom_values("mood");
if (isset($customField[0])) {
echo "Mood: ".$customField[0];

Save the file. Now when you'll write a new post, just create a custom field named mood and type your current mood as a value.

20 Responses

Feb 03 2009 20:18

Interesting! Showing the current mood on a post is something unheard of….

Feb 06 2009 03:09

Usually when I see the words “custom field” I immediately think “post image”. Never thought of trying something like this though, gives me ideas. Thanks.

Apr 16 2009 16:58

I already enabled my mood and music using this code, but I would like to know if there is a way to add a mood image below the mood text, the same way it’s done on LiveJournal. That’s one of the features of LJ I really like and would like to implement it into my WordPress blog.

Thanks in advance!

Aug 05 2009 12:19

Can i post mood by image such as : sad,happy,tried …

Nov 11 2009 15:57

I wish that someday Wordpress implement this feature for its free and wordprress-hosted blogs too!

Dec 22 2009 16:36

This is very cool. I just implemented this code on my friend’s personal blog and they loved it. Thanks for the helpful code snippet.

Jan 11 2010 05:07

thanx, nice tip :)

Jan 22 2010 05:53

Is it possible to enter multiple moods and break them into list-items () inside of the one entry of the value?

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required