How To: Integrate Twitter into Your WordPress Blog

Although I personally am not a major Twitter user, I do see the value in the service and have made several attempts to use it more often. For many others, it has become an addiction and possibly even a major time sink.

One trend we are starting to see more often lately is Twitter being integrated into WordPress blogs.  In the past we’ve featured a couple methods to integrate Twitter into your blog such as How to Add a “Tweet This” Link To Your Blog and How to Display Most Recent Twitter Entry. Even more recently there have been some WordPress plugins released to further integrate Twitter into your WordPress blog:

  1. Tweetbacks – This recent plugin by our friend Joost De Valk displays any “tweets” about your blog post below that post in the same way trackbacks/pingbacks are often displayed on WordPress blogs.   You can read more information about the plugin and how to install it here.  A similar plugin called TweetSuite was released recently as well.
  2. Twitter Comments – Works similar to Gravatars, but displays the comment author’s Twitter avatar instead.  If a Twitter avatar is not available, it will then attempt to locate a Gravatar to use instead.

Due to the popularity of WordPress, I would imagine this is only the tip of the iceberg and many more Twitter WordPress plugins will follow over the coming months/years. Out of curiosity, for those of you that are heavy Twitter users, what have you done to integrate Twitter into your WordPress blog?

Update: I just ran across this post over at Profit Blogger which shares more than 20 Twitter WordPress plugins that already exist.

  • Leave a Comment
  • Fixing CSS Drop-Down Menus That Hide Behind Flash Objects

    One of the more common issues with embedding a flash object on your home page (or any page for that matter) is that if it is near the navigation and you have CSS drop-down menus, then you may find your drop-down menu getting lost behind the flash object. If you haven’t dealt with this before it can feel like a nightmare, but fortunately it’s a pretty easy fix.

    The Problem: You have a CSS based drop-down menu in your navigation and a flash element near it the menus may get “hidden” behind the flash object.

    The Solution: Set the z-index of the div holding the flash to 1 and the z-index of the div holding the nav to 2.

    In the flash element:

    Look for the flash <object> tag and add the following code:

    <param name="wmode" value="transparent">

    You’ll want to insert this code right below the <param name=”quality” value=”high”> tag and include the code wmode=”transparent” in the flash <embed> tag.

  • Leave a Comment
  • How to: Upgrade your WordPress Blog in a Minute via SSH

    Having to upgrade your WordPress install every time a new version is released is necessary, but also very boring. If you have a SSH access to your server, here’s a very quick way to upgrade your WordPress install.

    This is probably the most important step of this whole tutorial: always backup your WP Database and files. This tutorial have been tested, however I won’t be held responsible for any kind of data loss.

    Once done, you can connect to your server by using SSH. On Mac and Linux platform you can use the Terminal, on Windows I recommend using Putty.

    Get the latest WordPress version available:


    Uncompress it:

    tar xfz latest.tar.gz

    Delete the wp-admin and wp-includes directories:

    rm -rf ./wp-includes/
    rm -rf ./wp-admin/

    Go to the wordpress directory:

    cd wordpress/

    Now, it’s time to copy the downloaded files to your existing WP install, by overwriting old files:

    cp -rpf -f * ../

    Once done, come back to the WordPress directory and remove the downloaded files:

    cd ..
    rm -rf ./wordpress/
    rm -f latest.tar.gz

    Visit your blog and upgrade the database (if needed). That’s all, your blog is now up to date and the whole process didn’t took more than a minute or two!

  • Leave a Comment
  • Automattic Acquires PollDaddy

    With all the acquisitions lately by Automattic (the parent company responsible for WordPress), you almost have to wonder what is next.   Well, today that question was answered when Matt Mullenweg announced that Automattic has acquired PollDaddy.

    Unlike the past few acquisitions, there is a good chance most of you are already familiar with PollDaddy, who is currently considered to be the leader in internet polling.   They are the polling service of choice by most bloggers because they are easy to build, can be integrated into your blog, and allow people to vote from most feed readers (increasing the number of votes you’ll receive).

    Here is a quote from Matt’s post (linked above):

    As we started to look at building out our own service for this, it became more obvious that, while on the surface it’s a very simple problem, there’s a lot of hidden complexity and opportunities for some really powerful features under the hood. There are probably a dozen companies addressing this space right now, but as we started to survey the space I was struck by how often I’d see this “PollDaddy” thing pop up.

    Two guys in Ireland with a quirky company name were cleaning up with some of the largest and most respected websites using their service on a daily basis. They weren’t the biggest, but they had the high end of the market. It seemed to be the WordPress of the polling space.

    According to their announcement, it looks like blogs are now fully integrated with PollDaddy and a PollDaddy WordPress plugin is now available for users. The PollDaddy plugin for us is similar in that it allows you to create and manage your polls from within your WordPress blog’s administration area!

    What do you guys think about this acquisition?

  • Leave a Comment
  • How To: Build a Categories and Archives Drop-down Box

    Over the past couple years I’ve really enjoyed monitoring trends in the blogosphere and one of the trends that has come up recently is blogger’s cleaning up their sidebars by adding drop-down boxes.

    If you’d like to build drop-down boxes for your categories and archives on your WordPress blog, here is the code you need:

    Archives Drop-down Code

    <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
    <option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
    <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>

    Categories Drop-down Code

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

    I think something like this can be a good idea if done with the right theme, but I have also seen it on a few sites where it didn’t look very good, so keep that in mind if you decide to move your categories and archives to a drop-down box!

    To see other code snippets we’ve featured here over the past year, check out our WordPress Code page!

  • Leave a Comment
  • How To: Displaying Your Most Commented Posts

    Though this isn’t quite the same as displaying your most popular posts in your sidebar, here is some code you can use to display the posts that have received the most comments.  You’ll want to place it in your sidebar where you want the code to be displayed.

    Most Commented Posts Code

    Go into your theme files and go to header.php file.   Somewhere within the </head> you’ll want to place the following code:

    <?php most_popular_posts($no_posts = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $duration='') {
    global $wpdb;
    $request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
    $request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
    if(!$show_pass_post) $request .= " AND post_password =''";
    if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
    $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
    $posts = $wpdb->get_results($request);
    $output = '';
    if ($posts) {
    foreach ($posts as $post) {
    $post_title = stripslashes($post->post_title);
    $comment_count = $post->comment_count;
    $permalink = get_permalink($post->ID);
    $output .= $before . '<a href="' . $permalink . '" title="' . $post_title.'">' . $post_title . '</a> (' . $comment_count.')' . $after;
    } else {
    $output .= $before . "None found" . $after;
    echo $output;
    } ?>

    If you’d prefer to display more than 5 posts, you can change the $no_posts = 5 code to whatever number you want to display.

    Okay, now, you need to figure out where you want to display these most commented posts (usually the sidebar) and place the following code:

    <?php most_popular_posts(); ?>

    And as is usually the case, if you want something easier, you can always go with a plugin such as the Popularity Contest plugin.

    To see other code that we’ve featured, check out our WordPress Code page.

  • Leave a Comment
  • Learn How to Secure Your WordPress Blog

    We hear almost every day about bloggers getting their login information comprimised. Are you one of the many people that are growing increasingly concerned about their blogs security?

    If you are looking up ways to beef up the security of your WordPress blog, Make Tech Easier has posted a great article about 11 ways to secure your WordPress blog. The post includes a few security tips we’ve already covered in past posts, plus a bunch of other great tips.

    Here is what information the post covers:

    • Encrypt your Login
    • Stop Brute Force Attack
    • Use a Strong Password
    • Protect your WP-Admin Folder
    • Remove WordPress Version Information
    • Hide your Plugins Folder
    • Change your Login Name
    • Upgrade to the Latest Version of WordPress and Plugins
    • Do a Regular Security Scan
    • Backup your WordPress Database
    • Define user Privilege

    Click over to get descriptions, plugin information and more!

    Got any tips to add? Let us know in the comments below!

  • Leave a Comment
  • 6 WordPress Tips and Tricks

    Adding A Side Blog

    1. Pick a desired category and add it in your blog (i.e. category “Side Blog”)
    2. Implement the following code into your “Functions.php” in your theme’s directory:

    function asidesFilter($query) {
    if($query->is_feed || $query->is_home || $query->is_ search) {
    $query->set(’cat’, ‘-115?);
    }return $query;}
    >add_filter(’pre_get_posts’, ‘asidesFilter’);>

    (Notice the number 115 is the category ID number for the chosen category. Yours will be different.)

    3. Then add the following into your “sidebar.php” file in your theme’s directory:
    <h3>Side Blog
    <a href=”FEED URL” title=”My Side blog's RSS feed.”>
    <img src=”RSS IMAGE URL” alt=”RSS” style=”position: relative; left: 0;” />
    <?php query_posts(’cat=115&showposts=2?); ?>
    <?php if(have_posts()) : ?>
    <?php while(have_posts()) : the_post(); ?>
    <div class=”aside_post”>
    <?php the_content(’Continue reading...’); ?>
    <?php endwhile; ?>
    <span class=”aside_archive_link”>
    <a href=”CATEGORY URL” title=”More asides.”>Archives</a>
    <?php else : ?><p>Sorry, the side blog is having a little trouble.</p>
    <?php endif; //if you delete this the sky will fall on your head ?>

    Enhancing Your “Read More” Link

    1. Open your “index.php” or file and find this line:
      <?php the_content(__(’Read more’));?>
    2. replace it with this one:
      <?php the_content(”Continue reading ” . the_title(”,”,false), 0); ?>

    Enhancing Your “Comments” Link

    1. Open your index.php, archive.php, and single.php and find this line:
      <?php comments_popup_link(’Leave a Comment’, ‘1 Comment’, ‘% Comments’); ?>
    2. Replace it with this one:
      <?php comments_popup_link(__(’No comments on ‘ . the_title(”,”,false)),
      __(’One comment on ‘ . the_title(”,”,false)), __(’% comments on ‘. the_title(”,”,false))); ?>

    Random Tip #1

    Do NOT use the following search code in the
    “search.php” file in your theme’s directory :
    <?php echo $_SERVER [’PHP_SELF’]; ?>
    Nobody should be allowed to search your entire server right?

    Use this instead:

    <?php bloginfo (’home’); ?>

    Random Tip #2

    Yet another bad code used in title tags or search templates:
    <?php echo $s; ?>
    as it allows some harmful Sql injections =(.

    Use this instead:
    <?php echo wp_specialchars($s, 1); ?>

    Random Tip #3

    Block search robots from your archive page by preventing the indexing:
    <?php if(is_archive()) { ?><meta name=”robots” content=”noindex”><?php } ?>
    Paste it anywhere in the “Header.php” file of your current theme’s directory in the <head> tags.

    Hope this helps. Thanks for reading and have a wonderful day!

  • Leave a Comment
  • How To: Adding a Store to Your WordPress Blog

    Depending on the type of WordPress blog you run, you may have an interest in building a small store into your blog.   I’ve found this is a great way to make some extra income to cover your blog costs while at the same time providing your readers with a useful resource.

    How to Add a Store To Your WordPress Blog

    The method I’m going to cover here is the method I use and have found a lot of success with.  It involves using a purchased software and eBay’s affiliate program to generate income.   Before I get started, I wanted to make one quick point.   This method is not for all blogs.  Because the generated income comes from being an eBay affiliate, this method is best applied to blogs that cover products or services that are regularly purchased on eBay.    Examples would be photography blogs (cameras and equipment), video game blogs (games and equipment), etc.   Things like celebrity blogs, make money online/affiliate marketing blogs, or personal blogs probably won’t find a lot of success with this method because it doesn’t relate well to an eBay product.

    In order to get started, you’ll first need to purchase the Build a Niche Store software (commonly referred to as BANS).  It has a one-time cost associated with it, but once you own the software, you get lifetime updates and you can use the software on unlimited sites.   The team behind BANS is incredible with both their dedication to updating the product as well as their support on their forums.   Owning BANS has really been a great experience for me.  The software has also developed a lot of trust over the past 2 years from its users, so it is a very safe investment.

    Once you’ve got your BANS license and downloaded the software, you’ll also get instructions on getting your first site setup.  It installs via a script so everything is really easy.  The only thing you’ll need to know how to do when purchasing this software is how to manually create a MySQL database (if you installed your WordPress software manually, you should already know how to do this).   You can always contact your web host to find out how to do this as well.

    You’ll want to create either a sub-domain or directory on your site where you want to place your new eBay store.   I generally use directories, but either should work the same.   Inside your new folder you created you’ll want to upload the BANS software and then visit the domain and go through the install.   If you run into any troubles on your first try, you can always consult the installation guide that comes with the product.

    How Do I Integrate Build a Niche Store (BANS) with WordPress?

    Now, BANS was not specifically created for use with WordPress, but was instead designed to run solo on a new domain name.   Fortunately, thanks to the hard working team over at The Niche Store Builder, you can now get WordPress themes that were specifically designed to integrate WordPress and BANS together.   In addition to creating their own unique BANS themes for WordPress, with Niche Store Builder you can also get BANS templates that were designed specifically for popular existing WordPress themes such as ThemeSpinner’s Chimera theme and Daily Blog Tips StudioPress theme.   You’ll get a matching skin for your BANS directory/subdomain and also a widget to display on the main site promoting some of your niche stores items.  These templates can be activated from the BANS control panel just like how a WordPress theme is activated.

    Here is a screenshot of BANS being used with the Chimera theme:

    And here is one for the popular StudioPress theme:

    I’ve been using this method on a few of my sites offering up cookbooks or whatever else is related to the content of the site and the income definitely helps cover domain renewals, hosting expenses, or whatever other costs come up.

    If you have any questions or run into any troubles, please let me know in the comments below!

  • Leave a Comment
  • WordPress Tip: Always Remove the WordPress Version Code

    I talked a couple of weeks ago about the importance of always upgrading your WordPress install, as old WordPress installations are often vulnerable.  One thing I don’t think people realize is that a hacker can easily find vulnerable WordPress blogs because most standard WordPress themes will actually tell them what version you are using.

    If you open up the header.php file of your theme, you should notice some code that looks something like this:

    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /><!-- leave this for stats -->

    In order to protect your WordPress installation, I recommend people completely remove this code from their header.php file for all of their WordPress blogs.

    Now, this obviously isn’t going to make your WordPress blog hack proof, but what it will do is make it so hackers can’t easily locate your blog if it is using a vulnerable WordPress installation.

    Update: Thanks to a tip from Leland, it looks like WordPress 2.5+ now generates the meta link anyway via the wp_head hook, which is something you can’t remove.  With that said, if you care about your security, you can still remove the meta generator.  It looks like Ian of ThemeShaper has provided a couple methods, including a WordPress plugin to remove the meta generator information from your WordPress blog.

  • Leave a Comment