Our Themes Have Been Downloaded Over 115,000 Times Click Here for Free WordPress themes

6 Easy WordPress Customization Tricks You Should Try

Has it ever happened that you come across a certain feature in a WordPress blog or a website and you think to yourself “I simply have to have this on my website"? This happens all the time, especially for those using WordPress as a platform for their brand and business. This is why we’ve listed five of the most used customization tricks you definitely need to try on your website. Although they involve a bit of coding, simply follow the explanation and you have nothing to worry about.

1. Change the homepage to a custom page

Setting a custom page for your homepage is one of the easiest and most sought after tricks people look for after they’ve finished installing WordPress for the first time. First, you have to create a new custom page, which can be accomplished simply by making a copy of the page.php file and renaming it. Then you need to go to the admin panel, make a new page and under the template, select the .php file you’ve created and published the page. Lastly, go to reading setting in the admin panel and select the static page, locate your template and you now have a custom home page.

2. Highlight comments made by the author

This is particularly useful feature, as it differentiates the author of a specific post from the rest of the comment section, which allows for easy detection of authors responses to various comments in the comment thread. Fortunately, it can be accomplished fairly easily, even by complete beginners. Go to your WordPress template folder, open the style.css file and add the following line of code:

authorstyle { background-color: #B3FFCC !important; }

After that, open the comments.php file, which you can find in the themes folder and replace

<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"></li>

with

<li class="<?php if ($comment->user_id == 1) $oddcomment = "authorstyle";
echo $oddcomment; ?>">

All that is left to do is to change 1 to the author’s user id.

3. Displaying the twitter follower count as plain text

Most people are annoyed by the little Facebook and Twitter count buttons. Even the most elegant of all designs can be thrown out of balance with a badly placed social media and count buttons. Thing is, you can display the count number as text and change the color scheme and the fonts so it blends with the design. To do that, create a new file called twitter.php and paste the following lines of code:

<?php
$tw = get_option("twitterfollowerscount");
if ($tw['lastcheck'] < ( mktime() – 3600 ) )
{
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=yourtwittername);
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
$tw['lastcheck'] = mktime();
update_option("twitterfollowerscount",$tw);
}
echo $tw['count'];
?>

All that’s left to do is replace the "yourtwittername" with your twitter name and place this snippet code wherever you’d like to display the count:

<?php include("twitter.php"); ?>

4. Control the availability of your posts using RSS feeds

As it often happens in content-oriented business, a post gets published which under closer inspection appears to have an error. Of course, you change it via the admin panel, but the post has already reached the feeds. Using this code snippet, you can actually set a delay which will allow you to recheck the post live. Simply open the functions.php file, add the following lines of code and change the 10-minute mark to whatever suits you best.

function publish_later_on_feed($where) {
global $wpdb;

if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate('Y-m-d H:i:s');

// value for wait; device
$wait = '10'; // integer

// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR

// add SQL-sytax to default $where
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}

add_filter('posts_where', 'publish_later_on_feed');

5. Remove the Update Notification

When users log into the backend, WordPress by default sends each user a notification whenever a system gets an update. This can become pretty annoying once you started working with WordPress on regular basis, and all you have to do to get rid of the notification for all users except for those with Administrative rights is to open the functions.php file and paste the following lines of code:

global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
    add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
    add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}

6. Disable HTML in comments section

A very useful option almost all web developers use on their websites. It effectively fights spam by disabling the link so one can click on it accidentally. This can be disabled either by using a specific plugins or by editing the functions.php file. Honestly, the more plugins you install, the longer it will take to load them all at once. It’s recommended to avoid over-installing plugins, especially in cases where a simple copy paste job can suffice. To disable the html, open the functions.php file and add the following:

// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {

// convert everything in a comment to display literally
$incoming_comment['comment_content'] = <br>htmlspecialchars($incoming_comment['comment_content']);

// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );

return( $incoming_comment );
}

// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {
// Put the single quotes back in
$comment_to_display = str_replace( ''', "'", $comment_to_display );
return $comment_to_display;

Final Words

These were just some of the many ways you can customize your WordPress website. Most of them involve getting your hands dirty and manually applying the necessary code, while others can easily be accomplished by using a specific plugin. Just be careful with how many plugins you install, as they can slow down your website drastically and you’ll end up risking getting penalized by Google and other search engines. Weigh out the pros and cons of using a plugin, and if you can edit a few lines of code instead, then that may be your best option.

Disclosure: This post contains external affiliate links, which means I receive commission if you make a purchase using this link. The opinions on this page are my own and I don't receive additional bonus for positive reviews.
Sam Cyrus

Sam Cyrus Author

Author bio: Sam Cyrus is an SEO Expert from Sydney. Sam is also a creative writer and likes to share his insights on entrepreneurship, business, online marketing, SEO and social media. He currently collaborates with Nirmal Web Design Sydney.