10 WordPress Tips to Take You to the Next Level


Are you getting the most out of your WordPress blog or website? Obviously not since you are reading this post, which by the way you shouldn’t forget to share with your friends, family, and neighbor’s cat. The beauty of WordPress lies in its massive scope of possibilities to experiment and create amazing things you’ve never dreamed of. In this post, I will share with you ten incredible tips I’ve come across and really found useful. I hope you discover something new.

  1. How to add an author section in your posts

  2. You’ve just written a fabulously eloquent post called “5 Reasons Why Twitter is Better than Beer Pong.” Things are looking great on Google Analytics, and people are submitting the article to Digg and Stumbleupon in massive numbers. Problem is, no one knows who wrote this Shakespearean masterpiece. Here’s how you can add a simple author section in the bottom of your posts.

    First off, make sure your author bio is completely filled out in your profile page(name, website url, biographical info). Then, proceed to your single.php file. Add the following chunk of code:

    <div id="author-info">
           <div id="author-image">
        	   <a href="<?php the_author_meta('user_url'); ?>"><?php echo get_avatar( get_the_author_meta('user_email'), '80', '' ); ?></a>
           </div>   
           <div id="author-bio">
              <h4>Written by <?php the_author_link(); ?></h4>
              <p><?php the_author_meta('description'); ?></p>
           </div>
    </div>
    

    Here, three div’s mark out the structure of your author section. The author-info id boxes the entire content, the author-image id is where your handsome face will sit, and the author-bio id is where your author bio will show. I’ve also included some handy WordPress template tags as well.

    Now that you have the HTML/PHP set up in your single.php file, it’s time to style the author section in your style.css file. Here’s the CSS I used to style my author section:

    #content div#author-info {
    	background: #eaeaec; padding: 10px; margin: 0 0 15px 0;
    	-moz-border-radius: 8px;
    	-webkit-border-radius: 8px;
    	border-radius: 8px;
    	overflow: auto;
            box-shadow: 1px 1px 12px #2D1D1D;
            -moz-box-shadow: 1px 1px 12px #2D1D1D;
            -webkit-box-shadow: 1px 1px 12px #2D1D1D;
    }
    	#content div#author-info div#author-image {
    		float: left; margin: 0 10px 5px 0; border: 5px solid #DCDCE1;
    	}
    

    Here, I used some wicked-cool CSS3 box shadow effects that probably won’t impress you. Feel free to use it on your blog.

    Source: Line 25

  3. How to Delay RSS Feed Publication

  4. Oftentimes, you finish a post and hit publish. The next day, you find out that something is terribly wrong. For instance, you mistakenly quoted the Pope as being the person who you played golf with last week rather than your friend Poppy. Sure, you can quickly edit the mistake but that will not do you any good for your RSS feed readers. With your credibility forever tarnished, all hope is lost. Right?

    Luckily, WPEngineer has a solution for you. Simply add this code to your functions.php file:

    /**
     * puplish the content in the feed later
     * $where ist default-var in WordPress (wp-includes/query.php)
     * This function an a SQL-syntax
     */
    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 = '5'; // 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');
    

    This code will delay the publishing of your latest post to RSS feeds by 5 minutes. Of course, you can adjust that span of time by changing line 14 above.

  5. How to Add Hotlink Protection to your site

  6. Content thieves exist on the Internet. (NO WAY!) Don’t believe me? Then you should check your site for copycat offenders at Copyscape.com . Whereas there is no sure way to directly remove this plagiarized content, you can at least deter some thieves by using this hotlink protection method in your .htaccess file located in your root directory:

    Make a backup of your .htaccess file before proceeding! Trust me! Don’t cry to me about it in the comments section below if you forget. :(

    #Begin Hotlink Protection
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yoursite\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
    RewriteCond %{HTTP_REFERER} !msn\. [NC]
    RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.feedburner.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://feeds.feedburner.com/yoursite$ [NC]
    RewriteRule .*\.(jpe?g|gif|bmp|png|jpg)$ /images/nohotlink.jpe [L]
    #End Hotlink Protection
    

    I highlighted the three lines you need to change above. So far, this method has worked brilliantly for me, and also not so brilliantly. Before, I did not include the feedburner code, and thus all of my images in my RSS Feed began displaying my hotlink image, which by the way looks like this:

    Intimidating? I thought so. Please use this with caution though, especially since you are dealing with the .htaccess file.

    I no longer enable hotlink protection on this site due to its inconsistency and tendency to replace images on this site with the hotlink image. If you have a better method, please feel free to share them in the comments section below.

    Source: David Airey

  7. Read More link jumps to top of post page

  8. By default, the &lt;!--more--&gt; tag will send readers to the location of the tag on the post. Alternatively, you can have the more link send readers to the top of the post page instead. Simply, add this code to your functions.php file:

    function remove_more_jump_link($link) { 
    $offset = strpos($link, '#more-');
    if ($offset) {
    $end = strpos($link, '&quot;',$offset);
    }
    if ($end) {
    $link = substr_replace($link, '', $offset, $end-$offset);
    }
    return $link;
    }
    add_filter('the_content_more_link', 'remove_more_jump_link');
    

    Source: WordPress Codex

  9. Prevent WordPress from replacing code snippets with “normal” quotes

  10. Imagine my angst when I sat in front of my pathetic Gateway laptop wondering why the code I used from a site doesn’t seem to work when I paste it into my files? I obviously made no errors since I’m a coding god, so it must be the Internet’s fault right?

    By default, WordPress replaces quotes in code snippets you copy and paste from somewhere and converts them to “curly” quotes instead of the “normal” quotes. To solve this, paste the following line of code into your functions.php file:
    [php]<?php remove_filter(‘the_content’, ‘wptexturize’); ?>[/php]

    Source: WPRecipes

  11. Display Total Number of SQL Queries on Your Blog

  12. Queries are evil. They slow down your site as you begin to accumulate more, which can negatively effect the user experience. In fact, Google agrees too. The first step to lowering queries is to know how many you actually have. Simply paste the following line of code somewhere on your site. I prefer going after the footer.php file.

    <?php if (is_user_logged_in()) { ?>
        <?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
    <?php } ?>
    

    If you want this to be publicly shown, simply remove lines 1 and 3.

  13. Split posts into separate pages

  14. This tip is quite handy when you are dealing with lengthy posts, especially those that contain a lot of pictures. To reduce the possibility of people jumping ship as they wait for your “1,000,000,000,000 Pictures of Funny Cats” epic post to load, add this tag to any section of your article you want to split into a separate page:

    Pages: 1 2

  • http://ileane.wordpress.com/ Ileane@Blogging

    Hi Tony, thanks for sharing these tips. #9 is my personal favorite. It’s simple and it’s good to remember when you are doing a guest post on another WordPress blog.
    I’ll share this with some other WordPress users.
    @Ileane
    .-= Ileane@Blogging´s last blog ..SEO Site Tools Finds Google Page Rank =-.

    • http://loneplacebo.com Tony Hue

      Sharing is caring, Ileane. :)

  • http://40Tech.com Evan @ 40Tech

    Great stuff, Tony. I know a couple of these tips, but there are several that are new to me. I’ll have to give your SQL queries tip a try.

    One of my own favorite tips is highlighting author comments, by making them appear a different color from normal comments. I’d have to dig into my theme to remember how I did that, though.

    • http://loneplacebo.com Tony Hue

      Interesting thing you mention about the author highlighting. We both use the same theme, but I’ve been stumped trying to figure it out. I’ll make sure I tell you if I find out how to do it.

    • http://loneplacebo.com Tony Hue

      Whaddya know! I figured it out! Just enter this in the comments section of the style.css file: [css]#content li.bypostauthor {background-color: #B3FFCC!important; }[/css] Here are the articles that showed me how to do it: http://inspectelement.com/tutorials/7-very-simple-tips-and-tricks-for-getting-more-out-of-wordpress/
      and http://www.mattcutts.com/blog/highlight-author-comments-wordpress/

      The first one helped me figure out the selector and the second how to style the background color. It seems that !important is quite essential to showing the background color. I’ll try and figure it out later.

  • http://www.observingcasually.com Kosmo @ The Casual Observer

    Nice collection of tips. Where were you a few months ago when I was looking for them :)

    I have about a dozen authors on my site and have quite a bit of author-centric code.
    .-= Kosmo @ The Casual Observer´s last blog ..Review: Lady Antebellum – Need You Now =-.

  • http://www.webtechwise.com/ Omer Greenwald

    Great tips Tony! I like the hotlink protection tip for htaccess. very useful
    .-= Omer Greenwald´s last blog ..Does Your Blog Have Fixed or Fluid Layout? =-.

    • http://loneplacebo.com Tony Hue

      I agree. It’s a really useful tip.

  • http://www.pancakeseven.com Thorsten

    Great tips. Some of them are new to me. :)
    .-= Thorsten´s last blog ..30 extravagante Website Header Designs =-.

  • http://www.faqpal.com FAQPAL

    Excellent post, a few ideas I never thought of.
    .-= FAQPAL´s last blog ..30 Things to do After Installing WordPress | Tech’n'share Dot Com =-.

  • http://www.poolerpeach.com Monique

    Hey, Tony!

    No. 7 is terrific – I tend to be a bit wordy in real life and have (so far) avoided verbosity on my blog b/c I realized the page would run on and on. But no more…..
    .-= Monique´s last blog ..It’s all Greek to me =-.

    • http://loneplacebo.com Tony Hue

      Brevityness is divinityness. Thanks for stopping by, Monique! You’re awesome-tastic.

  • Herbie Hysteria

    great list, some useful tips here for beginners and pros alike!

  • Pingback: Rough Ride Creations Blog » Essential Wordpress Installation, Optimization & Security Resources

  • http://www.roughridecreations.com/blog Briana Malmstrom

    This is a really awesome resource! I thought it was so neat, I listed it in my most recent blog post, entitled: “Essential WordPress Installation, Optimization & Security Resources”. I think one of the first things I’m going to set up from your suggestions is the author section! Thanks for this, and keep up the killer work!

    • http://loneplacebo.com/about Tony Hue

      Whoo-hooo! Glad to hear that.

  • http://arrowrootmedia.com Jaki Levy

    These are great WordPress resources – I actually just started digging into a really really solid book on WordPress 3.0. It’s got some really nice code samples, and is written by a few pro WordPress developers (including some from Envato). I’m actually giving away 2 copies of the e-book on my site – check out the details about the e-book and the giveaway here – I think you’ll dig it : http://bit.ly/lq20Ff

    • http://loneplacebo.com/about Tony Hue

      Thanks for sharing, Jaki! I bought a WordPress 2.7 book similar to the one you shared. I’ll admit: I didn’t like it. Sure, it was a different author(Jean Baptist-Jung?), but most of the content was on his website. I’ve been eying this ebook by Jeff Starr and Chris Coyier of Digging into WordPress: http://digwp.com/book/

      I’m sure you’ve heard of it. If not, I think it’s also another great resource. I just think it has a price tag that doesn’t match my resources.

  • http://bohar2.myopenid.com/ bohar singh

    i want to add share link on every post of every page of blog but it is possible only on first default page but not possible on any other page.
    please reply me..

  • http://www.doitwithwp.com Dave

    That’s an excellent collection of tips. I particularly like the Adsense code after the first post in the loop and the function for retrieving your Twitter follower count. Nice article.