Like
Like Love Haha Wow Sad Angry

There are thousands of plugins out there, both free and premium, that could help to push up performance for our WordPress site and make life easier. Today I would like to share with you 8 simple yet useful plugins that you can count on for your site. All developed by our staff and free to use.

I also share the code that I have used, in case you want to build one for your own based on the WordPress guide.

#1 Activate maintenance mode

Your site is going to be under maintenance? I guess then it’s essential to direct your users to a maintenance page. The plugin code below will help you with that.

  <?php
/**
* Plugin Name: DW Active Maintenance Mode
* Plugin URI: http://cmspioneer.com/designwall/blog/11-plugins/
* Description: Add a maintenance page to your blog 
* Version: 1.0
* Author: DesignWall
* Author URI: http://cmspioneer.com/designwall/
* License: GPLv3 or later
*/
add_action('get_header', 'dw_active_maintenance_mode');
function dw_active_maintenance_mode() {
     if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) {
wp_die('Maintenance, please come back soon.');
 }
} ?>

Download plugin

#2 Disable links in comments

To keep your blog free from spam links, let’s make all links in comments non-clickable. Below is the right plugin code to count on.<

 <?php
/**
* Plugin Name: DW Disable Links in Comments
* Description: Convert hyperlinks in comments to plain text url.
* Version: 1.0
* Author: DesignWall
* Author URI: http://cmspioneer.com/designwall/
* License: GPLv3 or later
*/
remove_filter('comment_text', 'make_clickable', 9);
?>

Download plugin

#3 Add post thumbnails to RSS feeds

Post thumbnails are not automatically included in your RSS feeds, yet a handy plugin like this can help:

 <?php
/**
* Plugin Name: DW Add Thumbnail to RSS Feeds
* Description: Add post thumbnail to RSS feed items.
* Version: 1.0
* Author: DesignWall
* Author URI: http://cmspioneer.com/designwall/
* License: GPLv3 or later
**/
function dw_rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
   $content = '<p>' . get_the_post_thumbnail($post->ID) . '</p>' . get_the_content();
}

return $content;

}
add_filter('the_excerpt_rss', 'dw_rss_post_thumbnail');
add_filter('the_content_feed', 'dw_rss_post_thumbnail');
?>

Download plugin

#4 Add target=”_blank” and rel=”nofollow” to post content’s links

For better SEO practice, adding target=”_blank” and rel=”nofollow” to links are big help. All you need to do is running the plugin below.

 <?php
/**
* Plugin Name: DW Post Content Link Replacement
* Description: Add target="_blank" and rel="nofollow" to links.
* Version: 1.0
* Author: DesignWall
* Author URI: http://cmspioneer.com/designwall/
* License: GPLv3 or later
**/
function dw_link_replace_target($text) {
$new_text = str_replace('<a', '<a target="_blank"', $text);
return $new_text;
}
add_filter('the_content', 'dw_link_replace_target');
function dw_link_replace_rel ($text) {
  $new_text = str_replace('<a', '<a rel="nofollow"', $text);
return $new_text;
}
add_filter('the_content', 'dw_link_replace_rel');
?>

Download plugin

#5 Extra fields for author profile

Use the plugin below to insert Twitter and Facebook fields to your author profile page.

  <?php
 /**
 * Plugin Name: DW Extra User Fields
 * Description: Add extra fields to the user profile page.
 * Version: 1.0
 * Author: DesignWall
 * Author URI: http://cmspioneer.com/designwall/
 * License: GPLv3 or later
 **/
 function dw_extra_user_fields( $contactmethods ) {
  // Add Twitter
  $contactmethods['twitter'] = 'Twitter';
  // Add Facebook
  $contactmethods['facebook'] = 'Facebook';
  return $contactmethods;
 }
 add_filter('user_contactmethods','dw_extra_user_fields',10,1);
 ?>

Download plugin

#6 Track post views

It is critical to collect statistics for your every post. The plugin below tracks and displays the number of post views to help you come up with a better content strategy.

  <?php
 /**
 * Plugin Name: DW Post Views Counter
 * Description: To track and display post views counter.
 * Version: 1.0
 * Author: DesignWall
 * Author URI: http://cmspioneer.com/designwall/
 * License: GPLv3 or later
 */
 function dw_get_post_views($postID){
  $count_key = 'post_views_count';
  $count = get_post_meta($postID, $count_key, true);
  if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
  }
  return $count.' Views';
 }
 function dw_set_post_views($postID) {
  $count_key = 'post_views_count';
  $count = get_post_meta($postID, $count_key, true);
  if($count==''){
    $count = 0;
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
  } else {
    $count++;
    update_post_meta($postID, $count_key, $count);
  }
 }
 ?>

Download plugin

#7 Minimum comment length

It is smart to free your blog from spam comments by setting the minimum number of characters required. We set it to 20 characters in the code below. But the choice is yours to make!

  <?php
 /**
 * Plugin Name: DW Minimum Comment Length
 * Description: Set the minimum comment length and disapprove if it is too short.
 * Version: 1.0
 * Author: DesignWall
 * Author URI: http://cmspioneer.com/designwall/
 * License: GPLv3 or later
 **/
 add_filter( 'preprocess_comment', 'dw_minimum_comment_length' );
 function dw_minimum_comment_length( $commentdata ) {
 $minimalCommentLength = 20;
 if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ) {
   wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
 }
 return $commentdata;
 }
 ?>

Download plugin

#8 Copyright mark to feed

Never forget to protect your precious content from being stolen by adding copyright to it. Referring to this plugin and you are ready to go.

  <?php
 /**
 * Plugin Name: DW Feed Copyright Mark
 * Description: Protect your content with copyright.
 * Version: 1.0
 * Author: DesignWall
 * Author URI: http://cmspioneer.com/designwall/
 * License: GPLv3 or later
 */
 function dw_feed_filter($query) {
  if ($query->is_feed) {
    add_filter('the_content','dw_feed_content_filter');
  }
  return $query;
 }
 add_filter('pre_get_posts','dw_feed_filter');
 function dw_feed_content_filter($content) {
  $content.= '<p>This article is owned by <a href="http://cmspioneer.com/designwall/">DesignWall</a>.</p>';
  return $content;
 }
 ?>

Download plugin

How to use these plugins:

  • Download the zip file and unzip it

  • Copy the .php file to the folder wp-content/plugins

  • Go to Dashboard >> Plugins

  • Find the plugin then activate it

Just that simple and you are ready to go.

So that are 8 simple yet handy WordPress plugins you can try. Have you made any plugin for your site before? Do leave comments as we would love to hear about it. It would become good references for anyone in need.

Like
Like Love Haha Wow Sad Angry

Jin

Jin is Nanny at DesignWall, a leading WordPress development company which builds responsive WordPress themes and best WordPress plugins. She makes sure everyone is happy, every question is answered, every release is bug-free. She also blogs about our products and shares her WordPress knowledge with our readers. Jin is also a travel lover.

2 comments