Promote Your Popular Posts With Popularity Contest

I’ve mentioned before that there are a lot of crucial WordPress plugins that all blogs should use; however, this one I’m going to talk about is not one of them. Instead, this plugin is a great plugin for certain types of blogs that have several anchor posts that are their claim to fame.

This plugin is called Popularity Contest, and what is does it automatically monitor the traffic on your blog and displays a designated number of your most popular posts. This helps funnel new readers to the best and most popular work in the hopes of retaining them as a feed subscriber. It also has the additional benefit of showing a permanent link on every page of your blog’s sidebar, which will send a little search engine link juice to these posts and help emphasize them with search engine spiders.

How do I set up this plugin? As with most plugins that involves the sidebar, you will have to manually insert some code in order to get it working properly. Once you’ve uploaded and activated Popularity Contest like normal, you’ll find that this plugin is pretty easy to set up. You’ll want to determine where you want your popular posts to be displayed in your sidebar and paste the following code:

<?php if (( (is_home()) or (is_single()) or (is_page()) or (is_search() or (is_404()) or ($notfound == '1'))) && (function_exists('akpc_most_popular'))) { ?>
<h2>My Popular Posts</h2>
<ul><?php akpc_most_popular(); ?></ul> <?php } ?>
<?php if ((is_archive() && is_month()) && (function_exists('akpc_most_popular_in_month'))) { ?>
<h2>Most Popular Posts of <?php the_time('F Y'); ?></h2>
<ul><?php akpc_most_popular_in_month(); ?></ul> <?php } ?>
<?php if ((is_category()) && (function_exists('akpc_most_popular_in_cat'))) { ?>
<h2>Most Popular Posts in '<?php single_cat_title(); ?>'</h2>
<ul><?php akpc_most_popular_in_cat(); ?></ul>
<?php } ?>

If you use this code above, it will not only display your most popular posts in your sidebar, but it will actually add your individual categories most popular posts to that particular category, and display the most popular archive posts within your individual monthly archives. This will help improve navigation for readers digging through your blog’s categories and archives, in addition to your main pages.

  • 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 http://www.yourdomainname.com/go/phpdocumentname.php.

    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
  • Prevent Duplicate Pages with Permalink Redirect

    There are only a select few WordPress plugins that I would consider “must-haves” for all types of blogs, no matter what the blog is about. Whenever I set up a new WordPress blog for someone, the first plugin I install is called Permalink Redirect. Everything can be controlled from within the Options panel, and it works out of the box without anything manual to set up.

    What does this plugin do? If you are using the most current version of this plugin, you’ll see that it is able to manage several different aspects of your WordPress blog. Its main function is to do a 301 redirect for all of your pages.  This means that it will redirect any alternate URL’s to the URL of your choosing. For example, this plugin automatically does the following for this blog:

    Wrong URL(s):

    http://www.wphacks.com

    http://www.wphacks.com/

    http://wphacks.com

    Correct URL:

    http://wphacks.com/

    If a reader enters one of the above incorrect URL addresses trying to reach my homepage, it will automatically redirect them to the correct homepage for this blog.  Your browser already does this you say?   That is probably correct. Most 2nd generation web browsers do in fact do this for you, but search engine spiders don’t use web browsers. Instead, search engine spiders would actually count these as 4 different web pages and could penalize you for having duplicate content.

    This plugin will also do the same 301 redirects for all individual webpages, as well as give you the option of manually redirecting certain pages if you change the post slug of that particular post or page for whatever reason.

    One often forgotten feature is the ability to redirect your posts if you were to change the permalink structure of your blog. For example, if you were to start out with the popular URL structure that many WordPress users use for their blog that includes the dates of the posts in the URL, you could later switch to a different structure (such as removing the date information to improve your search engine rankings) and redirect it with this plugin. It will automatically redirect all of your old posts to your new URL structure and make a flawless redirection for any old inbound links, as well as guide the search engine spiders to index your new post structure. An example of how this would look if I did this for this blog:

    Old URL:

    http://wphacks.com/2007/10/06/wordpress-plugins/

    New URL:

    http://wphacks.com/wordpress-plugins/

    What about feed redirection?  Many bloggers now take advantage of the amazing features Feedburner has to offer by setting up their blogs feed with them.   This can prove to be a bit of a headache to adjust all of your blog’s feeds to point to your new Feedburner feed, so this plugin will also take care of this for you. When in the options panel, simply enter your Feedburner feed address and save, and any time someone clicks on your default feed, they will automatically be redirected to your new Feedburner feed. This will help ensure you have an accurate count of feed subscribers, rather than splitting them up on multiple feeds.

    Overall, I am a huge fan of this WordPress plugin, and encourage anyone with a WordPress blog to use it. Now that tags are built into the default install of WordPress, I’m hoping this will be the next feature to be built into the software. It is definitely crucial in my opinion.

  • Leave a Comment
  • How To: Separate WordPress Comments and Trackbacks

    Note: For WordPress 2.7 and newer WordPress installations, you’ll instead want to use this tutorial.

    With all the WordPress themes available to WordPress users, it always surprises me how these incredible theme authors don’t take a few extra seconds to separate their theme’s trackbacks from the comments. It doesn’t look very professional and it can make it extremely difficult to follow a conversation in the comments.

    Separating your trackbacks and comments requires a minimal amount of coding work to set up. First, you’ll want to make a backup of your comments.php file just in case something goes wrong. Next, follow these three steps:

    1 ) Access your comments.php file and locate the following code:

    <?php foreach ($comments as $comment) : ?>

    Immediately after the above code, you’ll want to place this code:

    <?php $comment_type = get_comment_type(); ?>
    <?php if($comment_type == 'comment') { ?>

    2 ) Next, you’ll want to scroll down a little bit and locate the following code:

    <?php endforeach; /* end for each comment */ ?>

    Immediately before the above code, you’ll want to place this code:

    <?php } /* End of is_comment statement */ ?>

    This will filter out all of the trackbacks and pingbacks from your main comments loop. Now we need to create a second comments loop to display the trackbacks and pingbacks.

    3 ) Almost immediately below the code from step 2 you should find this code:

    <?php else : // this is displayed if there are no comments so far ?>

    Immediately before the above code, you’ll want to place this code:

    <h3>Trackbacks</h3>
    <ol>
    <?php foreach ($comments as $comment) : ?>
    <?php $comment_type = get_comment_type(); ?>
    <?php if($comment_type != 'comment') { ?>
    <li><?php comment_author_link() ?></li>
    <?php } ?>
    <?php endforeach; ?>
    </ol>

    You can adjust this code to display how you want to, including using a different header if you have a specific look for your header 3.

  • Leave a Comment
  • How To: Prevent WordPress Plugins From Breaking Your Blog

    Have you ever deactivated a WordPress plugin only to find that it broke your blog won ‘t load any longer?  This is most common when you have your plugins deactivated because you are upgrading WordPress. 

    The reason this is happening is because many WordPress plugin authors provide the call to the plugin without using an “if”.  This causes the call to the plugin to break your page when the server goes to pull the plugin code and discovers it has been deactivated.  

    This actually isn’t very difficult to fix, so I figured I would write a quick post explaining how to do so.    I’ll use the popular Related Posts plugin for my example.     Once you’ve downloaded and installed the plugin, you’ll need to place some code where you want the related posts to display.    The plugin author gives you the following code to use:

    <?php related_posts(); ?>

    As you can see, there is no if/then involved, so it will cause problems if you deactivate the plugin.   Here is how the code needs to look to avoid breaking your blog:

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

    You just need to take the related_posts in drop it in there twice.   This way if you deactivate the Related Posts plugin, it won’t cause any problems. 

    To avoid problems in the future, I recommend going through your plugin list and converting all your plugin calls to the above format.  

  • Leave a Comment
  • Ultimate SEO WordPress Plugin: All-in-One SEO Pack

    I’ve talked to several bloggers who spend a lot of time working on optimizing their websites for search engines, and often without good results. This can be attributed to several things, but often times it is the result of a lack of SEO knowledge, or to many SEO plugins that overlap and conflict with each other.

    If you have more than one SEO plugin installed to do various functions for your blog, you have to many SEO plugins installed. WordPress users actually have free access to a very well done plugin called All-in-One SEO Pack, which currently does everything out of the box. I don’t pretend to be an SEO expert, but then again I don’t have to be with this plugin.

    What does All-in-One SEO Pack do exactly? I don’t know how better to describe it than to just say that it does everything! And the best part is that it doesn’t require any coding work.   You can actually control everything from the Options panel of your WordPress SEO dashboard.

    Here is a screen shot of what my options panel looks like:

    All in One SEO Pack Options Menu

    By default, WordPress will use your blog’s tag line for the description and keyword tags. With this plugin, simply enter your homepage information once (name, description, keywords, etc.) and it will automatically add the information provided to your homepage’s meta information. This determines what search engines will display when your blog’s homepage shows up in search results.

    For your individual posts, you will want your meta information to be customized to each individual post you do to help get the most optimal indexing with search engines. This plugin allows you to set everything up to happen automatically, or you can do it manually on certain posts if you wish.

    Here is a look at the menu placed on your Write panel to enter your individual post information:

    All in One SEO Pack Write Menu

    • Titles Tags – By default, WordPress will add your post title as the title tag for the individual post, but this is not always ideal. One thing a lot of successful bloggers do is target their title to their readership, but use a different title tag which targets search engine traffic. When the search engines spider your blog, they pull the meta title tag, not the post title. With this plugin, your Write panel will now display a field to enter a custom title tag that the search engines will use, but your readers will never see your meta title unless they view your pages source.
    • Meta Keywords – By default, WordPress will use your category assigned to your post as the keyword, but we all know this is often not a great indicator of what the post is about. All-in-One SEO Pack also provides a keyword field that you can enter in your own keywords, but it also allows you to automate this process if you wish. Because you can integrate it with the Ultimate Tagging Warror plugin, and UTW allows you to automatically assign your categories as tags, you can actually have this plugin insert your UTW tags (which includes your categories) as your meta keywords automatically. (Be sure to set UTW to not automatically use tags as meta keywords because you will then have duplicate keywords).  This will also go through and update your older posts with keywords.
    • Meta Description – The meta description is the description that the search engines will use when displaying their search results, so this can be just as crucial as your title when it comes to getting web surfers to click over to your website. In the Write panel, this plugin gives you the option of inserting a custom description of your post, but that could be quite tedious very quickly if you write a lot. This plugin also offers another solution that I haven’t found on any other SEO plugins, and that is the ability to automatically insert the first 160 characters of your post as the description.

    Other features include the ability to automatically exclude your sites categories and archives from being indexed (to avoid duplicate content being indexed) without the use of Robots.txt. This is extremely useful for bloggers that don’t know much about making a Robots.txt file to guide the search engine spiders through your blog. You can also set your title formats to look exactly the way you want them to (posts, tags, pages, search results, archives, and even categories).

    How do I set up the All-in-One SEO Pack plugin? It couldn’t be easier. Just upload the plugin and activate it and you’ll be all set to start using it. This also means it is incredibly easy to update the plugin as well, which will be extremely handy because the author releases updates regularly (sometimes several a week). Some may not like that, but I look at that as an author who is committed to making his plugin the best one available.

    I have to say that I couldn’t be any happier with this plugin as it is. It is constantly getting new features and more integration added each week it seems, and it already combines the best of other SEO plugins while and some unique features as well.

    If you aren’t already using it, I recommend you deactivate your SEO plugins and give this one a shot for awhile. If you are using it, I recommend you upgrade to the newest version, as the one you have is probably outdated.

  • Leave a Comment
  • How To: Limit How Many Archive Months WordPress Displays

    There has been much debate over the value of displaying your archives on your WordPress blog. Some people are all for it, while others feel that you should move any archives to their own page. No matter which camp you are in, I think both can agree that if you do display your archives, you do not need to display an overabundance of them.

    By default, most WordPress themes come with some standard code to display your blog’s archives by month and with no limit to the number of archives to display. Typically the code will look something like this:

    <h2>Archives</h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>

    This will be fine for the first 6 months are so, but once your blog gets a little more established, you’ll probably notice that the number of months displayed are never ending. This can quickly become an eyesore for your blog and people generally won’t want to look at archives more than 6 months old. In order to set a rotating limit of months displayed on your blog, you simply need to make a small change to the above code to add a limit:

    <h2>Archives</h2>
    <ul>
    <?php wp_get_archives('type=monthly&limit=6'); ?>
    </ul>

    If you want to display more or fewer months, just change the 6 accordingly. Its really that easy!

  • Leave a Comment
  • Insert AdSense Into Posts with the Shylock AdSense plugin

    Looking to insert AdSense ads into the articles on your WordPress blog? If you aren’t good with manually editing the code for your blog, you may have experienced some frustration with trying to place Google AdSense advertisements on your WordPress blog. It can be even more difficult to wrap the ads properly so that your post content wraps around it.

    If any of this sounds like you, then let me tell you about an amazing WordPress plugin called Shylock AdSense plugin. First thing you’ll want to do is download the plugin from the authors website. Once this done, the plugin activates like normal by simply uploading it, then activating it from the plugins folder.

    After successfully activating the plugin, the first thing you want to do is head over to the Options panel and click on Shylock AdSense. You’ll be greeted with an easy to navigate menu that allows you to set up 10 different customized AdSense codes (you can use different block sizes or different colors) for use on your site. You can get this code generated from Google AdSense.

    Once this is done, you can scroll down and view a series of drop-down menus that allow you to control where these ads will be placed on your homepage, your individual pages, and your individual posts (you can pick top right, top left, middle, bottom, etc.). Once you’ve pasted your code that Google AdSense gives you, there is no additional coding involved. Everything is actually controlled from right within this menu by selecting the advertisement block and then selecting where to display it.

    Shylock AdSense PluginWhile this stuff is all useful, what really separates this plugin from the other AdSense plugins that are available is the ability to designate a number of days before your advertisements will appear on your single page posts. This allows you to avoid displaying ads within your homepage posts where your regular readers will see them, but will allow you to start displaying them on your archived individual posts so search engine traffic will see them.

    At this point, this plugin is currently in its early stages with version 1.1 and is already very useful. It also has a lot of potential for continued improvement. The main thing I would like to see is some form of the AdSense-Deluxe plugin integrated, giving you the ability to manually add individual AdSense ads only in designated spots (such as really long posts) by placing some code in your post when you want to do display an advertisement (such as <–Code 1–> or something similar). I would also like the ability to name the AdSense code blocks that are pasted in (such as 468×60 Blue or something similar).

  • Leave a Comment
  • How To: Hide WordPress Pages

    Looking to hide WordPress pages? If you’ve downloaded a WordPress theme that has been made available to the general public, it is likely that, by default, it has some code that automatically inserts your WordPress pages directly into your theme without any manual coding. This is a really great feature most of the time, but sometimes there are certain pages you’d like to not display in your menu or not display at all (search results page comes to mind).

    Hide WordPress Pages

    Here is how the menu code probably looks in your theme:

    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>

    If you have a individual page you’ve created, but don’t want to display it in your blog’s menu, you simply need to add an exclude command and the page number (this can be found on Manage -> Pages) to your existing code. Here is how the same code would look if I was excluding page 55:

    <?php wp_list_pages('depth=1&sort_column=menu_order&exclude=55&title_li=' . __('') . '' ); ?>

    If you’d prefer to exclude more than one page, you can do so by simply adding a comma between each page number like so:

    <?php wp_list_pages('depth=1&sort_column=menu_order&exclude=55,422&title_li=' . __('') . '' ); ?>

    This code will exclude pages 55 and page 422 from your page menu.

    Any other questions?  Feel free to post them below.

  • Leave a Comment