How To: Blocking Your WordPress Categories and Archives From Google

We all know that duplicate content can be a problem. People copy your work, re-post it on their website, then you both are penalized for duplicate content! Unfortunately, there isn’t much that can be done about that, but did you know that often blogs have duplicate content within their own blog? The biggest culprit for duplicate internal content is your archives page, which is usually used for categories and monthly archives. Unless you only display partial posts in your archives, you’ll want to make sure Google doesn’t index it. If you aren’t handy with Robots.txt, you can instead use this code to easily tell Google not to index your archive.php page.

<?php if(is_archive()){ ?><meta name="robots" content="noindex"><?php } ?>

You’ll want to grab that code and paste it anywhere in the header of your theme above the closing of the head tag. That way, Google will not index these, and search engines won’t refer traffic to your archive pages instead of your single post pages.

  • Leave a Comment
  • How To: Setting Up Auto-Discovery for Your WordPress Feeds

    Have you ever noticed that many next generation web browsers will often detect a blog’s feed by displaying a feed icon on the right side of the address bar?  This is something many estabalished sites have taken the time to set up to encourage feed subscribers, but something that most WordPress themes don’t do by default.  

    In order to instruct next generation web browsers to automatically detect your WordPress blog’s feed(s), you’ll simply need to do is make a quick modification to your header.php file and add the following code:

    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />

    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Comments Feed" href="<?php bloginfo('comments_rss2_url'); ?>" />

    If your theme already has the first code in place for the RSS Feed, then you’ll just need to paste the second set of code in to display your RSS Comments Feed.  You can also swap out the PHP code and instead use your Feedburner feed address if you’d like.

    If you aren’t sure if you should bother to do this or not, never underestimate the power of suggestion.  It is an unobtrusive way to promote your RSS Feed and Comments Feed while not using up any valuable screen real estate.

  • Leave a Comment
  • How To: Avoid Blog Disasters With WordPress Database Backup

    Comments Off on How To: Avoid Blog Disasters With WordPress Database Backup

    Disasters are unavoidable and could happen any day, your server could have a crash one day and you will be left with nothing. Maybe your database will crash and you will lose all your posts. Your blog could be hacked too and someone may just delete all your posts. These are some things that could happen any day to anyone.

    Taking precautions to safe guard your WordPress Blog is one of the best option to stay on top of it. The key to remember is that your database is the backbone of your blog, if you lose it your blog will be bankrupt, having a regular backup is they key to keep your blog up and running at all times.

    WordPress is a platform that has many great developers working for it and providing with numerous amounts of plugins that could help to overcome the unavoidable.

    WordPress Database Backup is a handy and blog saving plugin that will help you take daily backups of your database, you can either run the backup manually or setup cron tasks (scheduled tasks) to send you a backup of your database on a day to day basis.

    The cron tasks have been introduced since WordPress 2.1 and if you do not have the latest version you should upgrade your WordPress installation first.

    Below are some detailed instructions and tips on how to use the WordPress Database Backup plugin to setup cron tasks to automatically send you emails every day so you have the latest copy whenever you require it.

    Step 1

    Download and activate the WordPress Database Plugin for your blog.

    Step 2

    Click on the Manage option in the Admin panel navigation and from there click on the Backup link in the submenu.

    Step 3

    Once you are in the backup page, you will see a lot of options. Scroll down till you see an option to schedule a backup. In the scheduled backup you will see various options to schedule you backup.

    You can schedule a backup varying upon how frequently you post on your blog. The best option is too choose a daily backup of your database. You will also be given an option to choose the database tables you want to backup. By default all core WordPress tables are backed up.

    While making a choice to backup other tables you should only choose those that are critical to running of your blog, if you choose all the tables there are chances that the script may fail due to reading huge data.

    If you want to backup all the tables the best option is to run the task manually and only email critical data to you every day.

    That’s it with three simple steps you can save your blog from liquidation and always be sure that you are one step ahead of failures. You just have to follow the steps once and then you can ensure that you have a plan against disaster.

  • Leave a Comment
  • How To: Add WordPress 2.3 Tags to Your WordPress Theme

    A couple of weeks ago the WordPress community was blessed with the latest release from the WordPress team, now known as WordPress 2.3. One of the included features was an extremely important and extremely useful one, which adds built-in tags to WordPress.

    If you have already upgraded to WordPress 2.3 and want to take advantage of this new feature, you will probably have to manually add this tagging feature to your theme. In order to add tags, you simply need to paste the following code where you want to display the tags:

    <?php the_tags(); ?>

    This will actually add the text “Tags:” before the output of tags, so you will not need to do this manually. If you would like to proudly display your tags in a cloud somewhere (most commonly in your sidebar), you can easily do so by using the following code:

    <?php wp_tag_cloud('smallest=8&largest=36&'); ?>

    This code tells WordPress to display your tags in alphabetical order with the smallest text being 8 point font and the largest font is 36 point font. You can adjust the font sizes to your preference.

    If you would prefer to stick with the Ultimate Tagging Warrior plugin, the author has stated that the plugin will be updated to work with WordPress 2.3  Most people, though, would probably prefer to switch to the new built-in tagging system. If you’d like to make the switch from UTW to the new WordPress tagging system, WordPress has made it easy to make the conversion with their import feature. You can find the import option under the Manage tab in your Dashboard. In addition to the ability to import your UTW tags, WordPress also allows you to import tags from other plugins such as Bunny’s Technorati Tags and the Simple Tagging plugin.

    Overall, I am extremely impressed with the new tagging feature found in WordPress 2.3 and even more impressed with how easy it is to convert your old tags to the new system.

  • Leave a Comment
  • How To: Adding Edit Buttons To Your WordPress Theme

    I talked previously about how there are a lot of basic things WordPress theme authors can do to make a theme more functional and appealing to WordPress users, such as separating blog comments from trackbacks.  Another thing that theme authors often forget to do is add “edit” buttons to posts, pages, and comments.   Having access to these buttons can save blog authors a lot of time when trying to manage their blogs.  As a result, I decided to write up a quick tutorial that explains the really simple process of adding edit buttons to your WordPress theme. 

    If you’d like to add an “Edit” button on your individual posts or pages, here is the code you will want to place somewhere in your post and/or page template (usually called single.php and page.php) where you want it to display:

    <?php edit_post_link(__("**Edit**"), ''); ?>

    If you’d like to add an “Edit” button to your individual comments, here is the code you need to place somewhere in your comments loop (usually called comments.php) where you want it to display:

    <?php edit_comment_link(__("**Edit**"), ''); ?>

    A couple of quick notes about adding edit buttons to your theme:

    • These edit links will only appear if you are logged in with the appropriate priviledges (administrator, editor, etc.).  Your traffic will not see them.
    • You can wrap them in a div or whatever you would like to and then set its position in your stylesheet to appear where you want it to. 
  • Leave a Comment
  • How To: Hiding Your Affiliate Links using WordPress

    With the increasing popularity of using affiliate links to generate income online, it can significantly improve your conversion rate on affiliate sign-ups by disguising your affiliate links using a URL with your domain name, then redirecting them to the appropriate affiliate. 

    The idea behind using this theory is that readers will click on it thinking it is an internal link on your site, rather than taking you to a third party site.  Another benefit is that all of your blog’s links point toward an internal address on your domain, giving you control to update the URL easily. This helps avoid dead links whenever a company changes a URL and makes it easy to update your affiliate links when the need arises.

    Redirects can be accomplished in a variety of ways, but as this blog focuses on self-hosted WordPress, I will be going over an easy way to do this using a PHP redirect.  Here are the steps I took when I hid my affiliate links for this website:

    1. Create a folder called “Go.”
    2. Create a .php document (this can easily be done with Notepad or any similar program) and name it after the appropriate affiliate link you are using.
    3. Now paste the following code into the document: <? header("Location: http://youraffiliatelinkurlhere"); ?>
    4. Hide Affiliate LinksSave it into the “Go” folder created above.
    5. Repeat steps 2-4 until you’ve created a .php file for each affiliate link.
    6. Go to your FTP and upload your “Go” folder directly to the public_html folder.
    7. Update all your affiliate links to point towards your new redirect!

    Your redirect will look something like

    You can name the documents whatever you want, or you can use a different name than “Go” for your folder name.   The important thing is that you remember what you named it so that you can use your new affiliate link!

  • Leave a Comment
  • How To: Add Widget Support to Your WordPress Theme

    If you are planning on making a WordPress theme available to the WordPress community, it has become somewhat of a necessity for it to support widgets. This is especially true now that recent WordPress installs now come with this ability built-in, meaning you no longer need a plugin to accomplish this. This will make your theme more appealing to a larger number of WordPress users because they will not need any coding knowledge to set up their sidebar to look how they want it to.

    If you would like to set up your theme to support widgets, I recommend you check out this post by Garry Conn entitled How To Widgetize a WordPress Theme. In his post, he provides a detailed walk through of how to widgetize your sidebar for a 2-column theme.

    According to Automattic, it is also really easy to add widget support to 3-column and 4-column themes:

    Instead of register_sidebar() you should use register_sidebars(n) where n is the number of sidebars. Then place the appropriate number in the dynamic_sidebar() function, starting with 1. (There are several other ways to use these function. See the API). You can even give your sidebars names rather than numbers, which lets you maintain a different set of saved sidebars for each theme.

    My favorite part about widgets is that it provides a extra option for theme users, but isn’t required to be used.  A theme that supports widgets can still be adjusted manually if you prefer to do things the hard fun way.

  • Leave a Comment