X

Display random messages of encouragement, posts

Storefront Review - woocommerce integration

Adding this snippet to the functions.php of your wordpress theme will allow you to display random messages of encouragement to an author when they create a new post. Messages are displayed in the title field and the content field of new posts and don't forget to update the array of messages to suite your needs.



Code Snippet:


add_filter( 'default_content', 'writingEncouragement' );
function writingEncouragement( $content ) {
global $post_type;
if($post_type == "post"){
$encArray = array( "Welcome! Please write a nice and informative page or post!",
"Now I know this will be some great piece you're going to write!",
"<h1>Don't procrastinate!</h1>",
"Finally started, huh? Okay then!",
"Blah blah blah. Why don't you write something good this time?",
"You were just SO GOOD last time, I hope you measure up now too",
"Error 404…. Just kidding",
"If you have an SEO plugin, don't forget to add the meta title and meta description infomration",
"Thank our <a href=\"http://antjanus.com\">Overlord Ant Janus</a> for this messsage",
"You are now participating on what is called \"on-site SEO \" where you create useful content, put keywords into the URL and optimize your meta information",
"This little piece of code can be used to create a wordpress signature or to automatically populate advertisement code"
);
$content = $encArray[array_rand($encArray)];
return $content;
}
}

function title_text_input( $title ){
$title = array( "Enter a GOOD, CREATIVE Title!",
"404 Post Not Found, I guess you can just rewrite it",
"Title rich in KEYWORDS goes here",
"Enter Title",
"Enter Writing Mode",
"How To: Write a GOOD post",
"Top 10 whatever"
);
$title = $title[array_rand($title)];
return $title;
}
add_filter( 'enter_title_here', 'title_text_input' );

Comments  Leave a Reply

  1. Creative, Fun, Surefire Way to Get the Attention of Blog Authors... May 22, 2012 at 11:00 am

    […] trick (found at wpsnipp) works by filling in the Title Box and/or the Editor Box with predefined text. And so when an […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!