Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

55+ Most Wanted WordPress Tips, Tricks, and Hacks

Last updated on by
Follow WPBeginner on YouTube
55+ Most Wanted WordPress Tips, Tricks, and Hacks

There are times when you come across a feature in a blog, and you just start thinking to yourself: How can I get this in my WordPress blog/site as well. Everybody have experienced this feeling. Sometimes you know you want it, and don’t know where to look for, or even what to look for. In this article we will be sharing some of the most wanted WordPress Tips, Tricks, and Hacks that you will definitely find useful.

These tutorials are classified under various skills level. For some tutorials, you will need to know basic HTML and some WordPress Knowledge. Use the link below as one of your resources:

WordPress Theme Cheat Sheet for Beginners

1. How to use a Custom Page as a Home Page in WordPress

This is one of the most wanted hacks that users want to know how to accomplish. First you need to learn how to create a custom page. You will need to duplicate your page.php or create a brand new .php file and add the following code at the very top:

<?php /* Template Name: WPBeginnerT1 */ ?> 

You can change the template name. Change any styling, that you want in that page. Go to your WordPress admin panel and create a new page and select this template.

Custom Page Template

Once you have published this page go to Settings » Reading in your admin panel.

Custom Homepage in WordPress

And select your page to be the homepage. Now you have yourself a Custom Home Page.

2. How to Create a Page that Displays Random Posts

Have you ever been to a site and saw this cool feature? They have a link in their top navigation to something like Stumbe! or Read Random Articles, or some other creative text. When you click on that link, it takes you to a page that displays one random page. Each time you refresh, you are delivered with a new post. Well this trick is just for you then.

You would need to follow the trick #1 in this article to create a custom page template. And simply paste this code in there:

    <?php
    query_posts(array('orderby' => 'rand', 'showposts' => 1));
    if (have_posts()) :
    while (have_posts()) : the_post(); ?>

    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

    <?php the_content(); ?>

    <?php endwhile;
    endif; ?>

This is a simple WordPress Loop that is running a query to display random posts and the number 1 in there is telling WordPress to only show 1 post. You can change that number, but most of the time people do it one post a time.

We have a Quick Reading Page on our site as well, so you can see this trick in action.

3. How to Display any External RSS Feed on Your Site

Display any External RSS Feed in WordPress

Have you seen other bloggers who display their other blog’s feed on their site. You want to do it too for extra promotion and traffic. Well here is the tutorial for you. Simply paste the following code in anywhere in your theme:

<?php include_once(ABSPATH.WPINC.'/feed.php');
$rss = fetch_feed('http://feeds.feedburner.com/wpbeginner');
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
?>
<ul>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) : ?>
<li>
<a href='<?php echo $item->get_permalink(); ?>'
title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
<?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>

4. How to Display Relative Dates in WordPress

Display Relative Dates in WordPress

Have you ever seen this in blog posts and comments and wondered how did this blogger manage to do this? Actually it is pretty easy.

You would need to download a plugin called WP-Relative Date

Once you have downloaded and activated the plugin, look in your single.php, index.php, and page.php for this code:

<?php the_date(); ?>

Replace it with:

<?php relative_post_the_date(); ?>

5. Allow Users to Submit News on Your Site

Submit a News in WordPress Site Feature

This trick is being adapted by many top sites to keep a useful resource section in their sidebar which is maintained mostly by site’s audience. Did you want to know how you could do that?

First you will need to download a plugin called TDO Mini Forms and follow directions.

6. Link to External Links from Your Post Title

Did you see other sites link to external posts from their post title? Well that is because it is completely useless to create a new post where inside you are going to tell users to go to another site to read it. You are wasting your user’s time. This trick will allow you to link to external links from your post title in WordPress.

First open your functions.php file and add the following codes in there:

    function print_post_title() {
    global $post;
    $thePostID = $post->ID;
    $post_id = get_post($thePostID);
    $title = $post_id->post_title;
    $perm = get_permalink($post_id);
    $post_keys = array(); $post_val = array();
    $post_keys = get_post_custom_keys($thePostID);

    if (!empty($post_keys)) {
    foreach ($post_keys as $pkey) {
    if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title') {
    $post_val = get_post_custom_values($pkey);
    }
    }
    if (empty($post_val)) {
    $link = $perm;
    } else {
    $link = $post_val[0];
    }
    } else {
    $link = $perm;
    }
    echo '<h2><a href="'.$link.'" rel="bookmark" title="'.$title.'">'.$title.'</a></h2>';
    } 

These codes must be placed in php tags.

Then open your index.php and find the following code:

<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>

And replace it with:

<?php print_post_title(); ?>

This can also be accomplished by a use of a plugin called Page Links To.

7. Use WordPress as a Free Email Newsletter Service

Free Email News Service using WordPress

Did you see other sites using Email Newsletter services? Well you can make your WordPress work this way as well. Simply follow this tutorial.

8. Display any Number of Posts in a Loop

Did you ever want to display a different number of posts on different pages. For example on your category pages, you want to display 10 posts which you can control from your Admin panel, but another page you want to show only 5 posts. Well this tutorial is just for you.

Open a Template file where you want to display an x number of recent posts:

// if everything is in place and ready, let’s start the loop

// to display ‘n’ number of posts, we need to execute the loop ‘n’ number of times
// so we define a numerical variable called ‘$count’ and set its value to zero
// with each iteration of the loop, the value of ‘$count’ will increase by one
// after the value of ‘$count’ reaches the specified number, the loop will stop
// *USER: change the ‘n’ to the number of posts that you would like to display

if ($count == "n") { break; }
else { ?>

// for CSS styling and layout purposes, we wrap the post content in a div
// we then display the entire post content via the ‘the_content()’ function
// *USER: change to ‘‘ to display post excerpts instead

// here, we continue with the limiting of the number of displayed posts
// each iteration of the loop increases the value of ‘$count’ by one
// the final two lines complete the loop and close the if statement

Source

9. Highlight Author’s Comment

Highlight Authors comment

Have you ever seen this on blogs where author’s comments are distinguished from other comments? Well this is a simple and easy trick.

First you need to open your style.css in your template folder and add the following:

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

Then you need to open your comments.php which is also located in your themes folder and find the code that looks some what like this:

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

Replace it with:

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

Note you must change 1 to the user id of the author. Once you do this, your blog comments will have a different background for the author’s comment compared to the rest.

Thanks to Matt Cutts for this tutorial.

10. Create Thumbnails for Each Post and Display Them

Create Thumbnails for Each Post in WordPress

This technique utilizes the new feature added in WordPress 2.9 to add Thumbnails to each post and you can display them anywhere in the loop.

11. Display Feedburner Subscriber Count as Text

Have you ever been to a site that is not using Feedburner button and is still showing subscriber count? Well they are probably using the trick we are about to share. Most designers use this trick to have custom styling and avoid the annoying feedburner button.

Simply copy and paste this code anywhere you like most likely sidebar.php

    <?php
    //get cool feedburner count
    $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=your feedburner id";

    //Initialize the Curl session
    $ch = curl_init();

    //Set curl to return the data instead of printing it to the browser.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    //Set the URL
    curl_setopt($ch, CURLOPT_URL, $whaturl);

    //Execute the fetch
    $data = curl_exec($ch);

    //Close the connection
    curl_close($ch);
    $xml = new SimpleXMLElement($data);
    $fb = $xml->feed->entry['circulation'];
    echo $fb;
    //end get cool feedburner count
    ?>

You can wrap it around in styling to make it look like however you want.

12. Display Twitter Follower Count as Text

There are users who absolutely hate buttons like Feedburner buttons or Twittercounter buttons. Are you one of them? Do you want to display your twitter count as text, so it blends in to your new custom design? Well then this hack is just for you.

First you would need to create a file twitter.php and paste the following code in there:

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

Make sure to replace wpbeginner with your twitter name.

Then Simply place this code anywhere you want to display this:

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

Source

13. Create Your Own Private Twitter Site using WordPress

Create Your Own Private Twitter Site Using WordPress

14. Control When Your Posts are Available via RSS

Control When Your Posts are Available via RSS

There are times when you publish a post and suddenly find an error. You can go back in the admin panel and change it, but it is already published in the feeds. With this hack, you can put a delay of as many minutes as you like, so you can double check the post live.

Simply open your functions.php and add the following code in there:

    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');

Change the time from 10 minutes to whatever you like.

15. Allow Multiple Authors to be Associated with One Post

If you run a multi-author blog and have a post coming up that more than one author has contributed to, you can use this trick. This trick is being used by many top multi-author blogs.

Co-Author WordPress Blogs

Simply Download a Plugin called Co-Authors or Co-Authors Plus

16. Change the Default Gravatar Button

Good Bye Mystery Man

The default mystery man is really annoying for most users. Plus if you have one more chance of branding your blog, then why not do it. Changing your default gravatar lets you brand your blog more. With this snippet below you can change your default gravatar.

First you need to open your functions.php which is located in your template folder. If you don’t have one then create one and insert the following code:

    add_filter( 'avatar_defaults', 'newgravatar' );

    function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo('template_directory') . '/images/gravataricon.gif';
    $avatar_defaults[$myavatar] = &quot;WPBeginner&quot;;
    return $avatar_defaults;
    }

In the code the image is being extracted from the theme directory and it is called gravataricon.gif obviously you will change it to your image name. Where it says WPBeginner, that is the name of the avatar of how it will show in your admin panel options area.

Gravatar Settings

Head over to your admin panel and click Settings > Discussion and change the icon, and now you have a branded comment area with your logo.

17. Display Random Header Images in WordPress

Random Header Images

Most blog designs get boring if they have a huge header picture and it is static. This is when this tutorial comes in to make your header images dynamic because it rotates on each visit. You can select as many images as you want to rotate randomly. It brings life to a blog.

First you need to name your images in this format:

  • headerimage_1.gif
  • headerimage_2.gif
  • headerimage_3.gif

You must separate the name with an underscore. You can change the headerimage text to himage or anything you like.

Once you have done that paste the following code in your header.php where you would like the images to be displayed or in any other file.

<img src="http://path_to_images/headerimage_<?php echo(rand(1,3)); ?>.gif"
width="image_width" height="image_height" alt="image_alt_text" />

Make sure that you change the number 3 if you decide to do more than 3 images. This code is not exclusive for WordPress, it will work with any php based platform.

18. Only Display Certain Categories in a Menu

Display Certain Categories in a Menu

In many cases, users only want to display certain categories in their navigation menu at the top of the page. There are limited spots, that can only be filled by top categories, but if you use the default wp_list_categories code, it will show all categories. This is why this hack below comes in very handy when you want to create a navigation menu and only display certain categories.

<ul class="navmenubar" style="float:left; width:730px;">
<?php wp_list_categories('orderby=name&include=7,9,19,16,1,5,17,23'); ?>
</ul> 

Note, you can also change the ‘include’ text to ‘exclude’ and show all categories and exclude those that you don’t want displayed. The numbers displayed in the code are the category IDs. Remember since WordPress shows categories in a list format, you will need to edit the CSS in order to make it work.

19. How set an Expiration Date for Your Posts

Set an Expiration Date for Your Posts

This hack comes becomes very useful when you are running a contest because you might be posting information such as clues or hints that you don’t want to stay up for ever. Instead of manually removing the article, you can just make it expire automatically. It also works if you have a product that you are offering a discount on. You posted it on your blog, but you don’t want that discount to stay on your blog after its over. So you can remove it automatically with this code.

All you need to do is replace your WordPress Loop with this code:

    <?php
    if (have_posts()) :
    while (have_posts()) : the_post(); ?>
    $expirationtime = get_post_custom_values('expiration');
    if (is_array($expirationtime)) {
    $expirestring = implode($expirationtime);
    }

    $secondsbetween = strtotime($expirestring)-time();
    if ( $secondsbetween > 0 ) {
    // For example…
    the_title();
    the_excerpt();
    }
    endwhile;
    endif;
    ?> 

Once you have done that, you can use custom fields when writing a post to set an expiration date. Make sure you select the key “expiration” and use the the following date format: mm/dd/yyyy 00:00:00

Now this hack does not remove or unpublish the article instead it just excludes the article from being displayed in the loop.

20. Delete Posts Revisions from Your Database

Delete Batches of Post Revisions

WordPress has a lot of good features and one of them is Post Revisions. This was included in WordPress 2.6, even though this is a good feature, it can cause some problems. One of them is increase the size of your database. Depending on how long it takes you to write a post, you might have as many as fifty post revisions. Now you can manually delete them, or you can run a simple query which we will show you in this post and get rid of all these useless revisions.

First thing you need to do is login to your phpMyAdmin and select your WordPress Database.

Click on the SQL Button and enter the following query:

DELETE FROM wp_posts WHERE post_type = "revision";

In this code basically we looked up a table wp_posts and removed every post that had a post_type revision associated with it. Now depending on the size of your database, this may save you a lot of space.

21. Create a Membership Directory using WordPress

Create a Membership Directory using WordPress

The end result is a moderated directory that allows members to enter information about themselves. Live Example.

22. Create a Peel Away Effect in WordPress

Peel Away Effect in WordPress

Have you arrived at a site where you see this page peel effect that some bloggers have. They are advertising their recent ebook, or some other product, and you want to do the same. Well then Hongkiat Blog has a great tutorial about this. The tutorial eliminates the use of plugin, but if you want an alternative option. Page Peel Plugin can get you the same functionality with a lot less work.

23. Custom CSS Stylesheet for Individual Posts

There are sites that use custom stylesheet for individual posts. Do you want to know how you can do it also? It is very simple. This is accomplished by the use of Custom Fields.

First you will need to open your header.php and insert this code somewhere in between <head></head> codes.

<?php if (is_single()) {
$customstyle = get_post_meta($post->ID, 'customstyle', true);
if (!empty($customstyle)) { ?>
<style type="text/css">
<?php echo $customstyle; ?>
<style>
<?php }
} ?> 

Once you have done that you can add a custom field in each post with the name customstyle and add the css codes in there.

For example if you want the a certain image to have border you can add:

#coolimageclass{border: 5px solid #ccc;}

Use the format above and you now have custom CSS for your single posts.

24. Easily Add Custom Header, Footer, or Sidebar on Different Categories

Did you ever come across a site that is using different header or sidebar for some categories? Well this is how you can accomplish that as well.

To call a particular header, you will need to open your index.php and replace your normal header code with this one:

<?php if (is_category('Blogging')) {
get_header('blogging');
} else {
get_header();
} ?>

This code above is basically telling WordPress that if someone opens the category called “Blogging” then WordPress needs to display a file called header-blogging.php if it exist. If it does not exist, or if the category is not blogging, then WordPress displays the default header file.

To get a separate sidebar for each all you need to do is add the following code:

<?php if (is_category('Blogging')) {
get_sidebar('blogging');
} else {
get_sidebar();
} ?>

The code above will look for sidebar-blogging.php to replace the default footer file if the category is Blogging.

To get a separate footer for each category all you need to do is add the following code:

<?php if (is_category('Blogging')) {
get_footer('blogging');
} else {
get_footer();
} ?>

The code above will look for footer-blogging.php to replace the default footer file if the category is Blogging.

25. Create a Custom Login Page Design for WordPress

Custom WordPress Login Page

Do you have a multi-author site, or a community site powered by WordPress? Do you want to rebrand the login page design? Then this tutorial is just right for you.

26. Place Content Only in your RSS Feeds

RSS Footer

Do you have a lot of RSS Subscribers? Well then maybe you want to monetize it just like tons of other users who are doing it. The plugin called RSS Footer lets you add content to your RSS Feeds. You can style it however you like.

27. Disable HTML in WordPress Comments

Did you ever see in your SPAM folder, how many comments have tons of HTML codes which is basically links. That is how most spammers add links. But you can disable HTML in WordPress Comments to be functional. So if someone uses the strong code, it will not bold the text etc.

All you have to do is simply open your functions.php and add the following code:

    // 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'] = 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( "'", '&apos;', $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( '&apos;', "'", $comment_to_display );

    return $comment_to_display;

Source – The original author also offers a plugin that you can download from his site.

28. Add Digg Buttons in Your Posts using Custom Fields

Doesn’t it get annoying posting digg buttons on your articles every time. But you don’t want to display them on every page by default because some articles are not digg worthy. Well this solution would be very helpful then. In this plugin, you will add the codes in your single.php once, and in each article that you want to display the button, you will just have to enable it using the custom field.

First open your single.php and find a code that looks like this:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Replace it with:

<?php if (have_posts()) : while (have_posts()) : the_post();
// check for digg button for single page
$digg = get_post_meta($post->ID, 'Digg', $single = true);
?>

Now you need to add the following code within the loop anywhere you like:

<?php // if there's a single page digg button
if($digg !== '') { ?>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<?php } // end if statement
// if there's not a digg button
else { echo ''; } ?>

You may wrap it around with any styling that you want. Save the single.php and upload it to your theme folder.

Now when writing a post if you want to add a digg post simply add a custom field like shown in the screen shot below:

Add a Digg Button in Your WordPress using Custom Field

Whenever you specify this custom field, WordPress will display a digg button on your post.

29. Display Latest Sticky Posts in WordPress

Assuming that you have already created a custom page template and/or already have The Loop ready, paste the following code before the loop.

    <?php
    /* Get all sticky posts */
    $sticky = get_option( 'sticky_posts' );

    /* Sort the stickies with the newest ones at the top */
    rsort( $sticky );

    /* Get the 5 newest stickies (change 5 for a different number) */
    $sticky = array_slice( $sticky, 0, 5 );

    /* Query sticky posts */
    query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );
    ?>

This code can very well be used in featured slider, or any other advanced feature that you would like to display on your site. This snippet is mostly geared toward a WordPress site that has a custom homepage or a magazine style look.

The credit to this code goes to Justin Tadlock and partially to Nathan Rice for coming up with the array slice solution.

30. Display a Retweet Button On Your Site

Add a Retweet button in WordPress

With Twitter getting so much exposure, as a blogger you should already be using it to your advantage. Power of twitter is like no other because it is word of mouth advertising. To make this easier on your readers, what you can do is place a prominent retweet button, so they can retweet the article with one click. Not only just that, but you should make it the way so you can track the retweets as well. That is where tweetmeme widget comes in.

In this tutorial we will have you create a button that will link to the text in the following format:

RT @yoursitename Title of the Post – Link

Add the following code in the template file of your choosing most likely single.php

For the Large Button:

<script type="text/javascript">
tweetmeme_source = 'wpbeginner';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"> </script>

For the Compact Button:

<script type='text/javascript'>
tweetmeme_style = "compact";
tweetmeme_source = 'wpbeginner';
</script> 

Remember to change the source to your twitter account name, this way you will not only promote your account to get more followers, but your article will be promoted as well.

31. Display Categories in a Drop Down Menu

Display Certain Categories in a Dropdown Menu

Some blogs have a lot of categories which they can’t display in their sidebar. Or some bloggers do not want to take up a lot of space displaying categories. This option allows them to have a select menu, dropdown menu, for categories. See WordPress Codex for details.

<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><input type="submit" value="View" /></noscript>
</form> 

32. Show Category Icons

Show Category Icons

Pictures make a site more lively which is a given which is why blogger might want to associate pictures with their category. This plugin lets you associate a specific icon of your choice to a designated category. You can use this plugin to list categories by icon with or without names, and much more.

Download this Plugin

33. Display the most Recent Post from a Specific Category

Did you see sites with a magazine style theme who are displaying posts from a specific category. Sometimes only the most recent post. Well you can do this too easily.

    <?php
    query_posts('showposts=1&cat=3');
    while(have_posts()) : the_post();
    ?>
    <ul>
    <li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>

    <ul><li><?php the_content(); ?></li>
    </ul>
    </li>
    </ul>
    <?php endwhile; ?> 

Add the above code anywhere you like in the template. Make sure you change the category ID and you can change the number of posts displayed as well if you want.

34. Future Post Calendar

This plugin adds a simple month-by-month calendar that shows all the months you have future posts for (and the current month no matter what), it highlights the days you have posts for, and as an added bonus if you click a day the Post Timestamp boxes change to that day, month and year.

Future Post Calendar

35. Modify Excerpt Length and More Tags

WordPress lets you display Excerpts, but up until version 2.9 you could not control the excerpt length. With the following code, you can increase the length from default 55 words to as many words as you like. Open your functions.php file and add the follwowing codes in there:

    // Changing excerpt length
    function new_excerpt_length($length) {
    return 100;
    }
    add_filter('excerpt_length', 'new_excerpt_length');

    // Changing excerpt more
    function new_excerpt_more($more) {
    return '…';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

Change the 100 word limit to the count that you desire.

36. Display Author’s Twitter and Facebook Information on their Profile Page

WordPress has fields for fields for author contacts, but it has not been updated in ages. So by default you do not have an ability to add author’s twitter or facebook. With this hack you can add this information on their profile page.

First open your functions.php and paste the following code:

    <?php
    function my_new_contactmethods( $contactmethods ) {
    // Add Twitter
    $contactmethods['twitter'] = 'Twitter';
    //add Facebook
    $contactmethods['facebook'] = 'Facebook';

    return $contactmethods;
    }
    add_filter('user_contactmethods','my_new_contactmethods',10,1);
    ?>

The above code will add two extra fields on your user-edit page named twitter and Facebook. You can display the code with the following code in your author.php file.

<?php echo $curauth->twitter; ?>

Source: Joost De Valk

37. Create a Contributors Page that lists Author with Avatars and Other Details

Create Author List with Avatars and Other Details

Do you run a multi-author blog? Do you want to create a content-rich contributors page. This tutorial is just for you.

38. Display Twitter Avatars in Comments

You probably have seen many sites using gravatars in comments because that is built-in. But there are some sites that are using twitter avatars, and if you are wondering how they are doing it then this trick will help you.

Twitter Avatars in WordPress Comments

Download the Plugin and follow this article for the instructions.

39. Create a Business Directory using WordPress

Create a Business Directory Using WordPress

This plugin lets you create a business/web directory which allows users to submit their links or other information.

40. Create a SIMILE Timeline using WordPress

Create a Timeline Using WordPress

41. Display Breadcrumb Navigation in WordPress

Have you seen sites that have a breadcrumb like ebay? Did you want to do it on your site? If you do then this plugin is just right for you. It has plenty of SEO advantage and it is extremely helpful to users.

Display Breadcrumb Navigation in WordPress

42. Create Your Own Facebook Application for Your WordPress Site

Facebook Application for Your WordPress Site

Did you ever want to utilize the power of Facebook by creating your own Application? Well WordPress lets you create an application for your blog. Follow this tutorial and utilize the power of facebook.

43. Display Most Recent Comments with Gravatars

Have you seen sites that display most recent comments in their sidebar with user gravatars. Well this can be done easily with these codes. Simply paste the following code anywhere you want to display the most recent comments.

    <?php
    $query = "SELECT * from $wpdb->comments WHERE comment_approved= '1'
    ORDER BY comment_date DESC LIMIT 0 ,5";
    $comments = $wpdb->get_results($query);

    if ($comments) {
    echo '<ul>';
    foreach ($comments as $comment) {
    $url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
    echo '<li>';
    echo '<div class="img">';
    echo $url;
    echo get_avatar( $comment->comment_author_email, $img_w);
    echo '</a></div>';

    echo '<div class="txt">Par: ';
    echo $url;
    echo $comment->comment_author;
    echo '</a></div>';
    echo '</li>';
    }
    echo '</ul>';
    }
    ?> 

To get more or less than 5 comments, change the number 5 on line 2.

Source: WPRecipes

44. Greet Each User with Appropriate Message

Greet Each User with Appropriate Message

If you like to read blogs, then you must have seen this on at least one blog. You can select to display a specific message to different users depending on the source they arrived at your blog. So for example, if someone comes to your blog via twitter, this plugin will show them a different text.

Download this Plugin: WP Greet Box

45. Display Different Social Media Submit Buttons

Many if not all blogs has some type of social media integration on their site. Most sites though have different social media sites button on their single pages, so they can get more votes. There are many plugins that can add this feature in your WordPress Blog. But this can also be done manually. Anyone who is curious should use this social media theme guide as a reference.

46. Digg/Bury Blog Comments

Digg-Bury Blog Comments

Did you ever wish that there was some type of voting system on your blog comments. Well this plugin has just what you want. It allows users to vote up or vote down the comment.

47. Redirect Your User’s Attention

Have you been to a WordPress site where you make your first comment and you are redirected to another page? If not, then you are at one right now. We redirect our first commentators to a Thank You Page. But this Plugin can be used for the sake of advertisement also if you want your users to know about your new product. Simply Download a plugin called Comment Redirect.

Comment Redirect

48. Add Twitter ID Field in WordPress Comment Form

Add Twitter Field in WordPress Comment Form

Many top sites including Mashable and Techcrunch are doing this. They have an additional twitter field in their comment forms. So users can put their twitter profile if they want to. This can be done in 5 easy steps if you follow the tutorial by clicking on the hack title.

49. Display Guest Author’s Name via Custom Field

Many Blogs are now having guest posts on their site. Some of these guest authors are one-time only authors, so there is no point in creating a separate profile for them just so you can display their name in the post. The smarter way to do this is by using the following code.

Open you single.php, or page.php in your template and add the following code where you display the author name:

<?php $author = get_post_meta($post->ID, "guest-author", true);
if ($author != "") {
echo $author;
} else {
the_author();
} ?>

This code will look for the custom field called guest-author if it is found, then it will display that name, otherwise it will display the_author function meaning the person who actually published it meaning you.

Note: You might have to remove the original the_author function before you place this.

Source: WPRecipes

50. Display Most Recent Tweet in WordPress

Twitter is getting very famous among bloggers. Many bloggers are now displaying their most recent tweet on their blog. If you want to display your most recent tweet on your blog simply place this code where you want to display it in your WordPress theme.

    <?php
    $username = "TwitterUsername"; // Your twitter username.
    $prefix = ""; // Prefix – some text you want displayed before your latest tweet.
    $suffix = ""; // Suffix – some text you want display after your latest tweet.
    $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";

    function parse_feed($feed) {
    $stepOne = explode("<content type=\"html\">", $feed);
    $stepTwo = explode("</content>", $stepOne[1]);
    $tweet = $stepTwo[0];
    $tweet = str_replace("&lt;", "<", $tweet);
    $tweet = str_replace("&gt;", ">", $tweet);
    return $tweet;
    }

    $twitterFeed = file_get_contents($feed);
    echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
    ?> 

e

Make sure to change the username in the first line.

51. Improve Your WordPress SEO

This is a detailed guide that will help you improve your WordPress SEO. We compiled it a while back and it has received many positive reviews from users.

52. Add Email This Article Option to Your WordPress Posts

Have you seen a site that gives you an option to email the article to your friend. If you have read a newspaper online, then you have. WordPress has a similar feature for the posts. You can add it by simply enabling a plugin called Email This.

Email This Article Plugin for WordPress

Once you have installed and updated the settings to your desire, simiply add this code in your single.php inside the loop.

    <?php if(function_exists('wp_email')) { email_link(); } ?>

This code will put a printer icon / link to every post page.

53. Create a Resourceful 404 Page Design

Best 404 Page Design

The above tutorial lists some of the elements that you should have in a 404 page design.

54. Improve Typography in WordPress

Have you ever wished that you can have rounded quotes, show elipses, your hyphens don’t get mixed up, well this is your lucky day because it can be done with a plugin called WP-Typography.

Web Typography Plugin for WordPress

55. Create a jQuery Carousel in WordPress

jQuery Carousel in WordPress

A great tutorial that shows you how to display your WordPress posts in a Carousel.

We hoped that you enjoyed this long and resourceful article. If you like it please retweet, and share it with your friends on Facebook.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • Christof

    Thank you so much! Even as a more experienced user this article is great!:)
    Could you please tell me how to disable the hyperlink of titles from one specific post or post category? Thanks!

  • Rubel Hasan

    As a beginner of wordpress , this article is very helfful to me

  • A

    You make this seem so easy but it’s not.

    Can you please help me?

    This is what my footer looks like on styles revised

    <a href="” title=””>
    And <a href="” title=””>



    ( I am not using quotes below, in capital letters I want it to link)
    At the bottom it says

    Proudly powered by WordPress And Revised.

    I moved the credit link to the top
    I want to put at the bottom
    © 2013 COPYRIGHT MYWEBSITENAME All Rights Reserved PRIVATE POLICY TERMS OF USE

  • Adel

    Hi. if I find this trick or hack, i will use wordpress:
    when you write a post and share to web. it is go to in top of first page of site and if you write 20 posts in under of page you can see: page 1 2 3 4… like a blog.
    How can I delete or change this mode. I like that when write a post. put it in lists that I made them before. for example: sport, art, women, … I like when visitore come to my site search a subject and find it directly or search and see lists and find subject, like wikipedia. How can I do that?

  • harvey

    hi ! one that you could add in this list and that I am asking you guys : how do you show in the sidebar the number of posts per category or per month ? My template doesn’t enable that, and I’d like to be able to activate that feature. Thanks !

  • Carla

    I tried adding the code for changing the default avatar image to my functions file. I copied it just as you have it and keep getting a white screen. I’m using Genius and am wondering if that has something to do with it? I can’t figure it out. Do you have any suggestions? I’d love to change the default image. Thanks!

  • Pablo

    Do you have an updated link for Example 21?

    • http://www.wpbeginner.com Editorial Staff

      Unfortunately not.

  • Naman Agrawal

    How to protect copy paste in wordpess without plugin :( ??

  • Amanda Taylor

    I’m trying to use #17. I named the images and put the code in my header.php and its not working. Am I missing something:

    <img src="http://path_to_images/headerimage_.gif
    width=”image_width” height=”image_height” alt=”image_alt_text” />

    • http://www.wpbeginner.com Editorial Staff

      Yes, you have to update the path_to part and fill it in with the right path.

      • Amanda Taylor

        Thanks!

  • vicky murgatroyd

    Hi, I am completely new to all of this and am beginning to set up my own site and this post was so helpful! It’s a slow process and I feel like i’m getting my head around a totally new language, so please excuse me if this is a stupid question…but I have been following #2 to set up a story spinner, and it has worked except that it displays the story twice – one in the usual format and one that looks different, at the top of the page. I know it is probably something extremely simple i’m doing wrong but I have no idea how to correct it and wondered if you might be able to lend a hand?
    So the code at the top of my page.php looks like this…

    ‘rand’, ‘showposts’ => 1));
    if (have_posts()) :
    while (have_posts()) : the_post(); ?>

    <a href="”>

    I’m sure it is something stupid but as I said…complete newbie and any help would be greatly appreciated! Thanks

  • http://www.cinemania.ws/ Cinemania

    Good collection. I like the #41 and #55

  • Jeremy

    Nice list, thank’s !

    Do you know how to display a list of popular posts without using any plugin?

  • http://freebookgroup.com/ Twin

    oh, I’ve used wp for kinda long time, but these tips surprise me much, thanks

  • http://eckstein.id.au/ ecksteing

    This is great list. I particularly like #4 ‘ How to show relative dates’. Thanks.

  • RajeshBhatia

    Thanks for the help gowebbaby.com.Your support has been excellent.

  • AliJaan

    i really like this post thanks for shairng my comment thanks <a href=”http://www.allsweetmessages.com/SMS-Messages/Sympathy-Messages.php”>sympathy messages</a>