KeywordLuv - Wordpress Plugin

Description

Reward your commentators by separating their name from their keywords in the link to their website, giving them improved anchor text.

Example

If they enter “Stephen@Custom WordPress Plugins” in the Name field, their comment will have:

Stephen from Custom WordPress Plugins Says:

rather than:

Stephen@Custom WordPress Plugins Says:

If they don’t enter the @ symbol, the anchor text will simply display as normal. For a live example, see the first comment below.

Why Is Anchor Text Important?

There are many articles about the value of having your keywords in the anchor text of backlinks to your site. This helps your site rank well for those keywords with the search engines, bringing you more traffic.

One source of backlinks are comments on DoFollow blogs, but the anchor text is normally your name. While this helps you rank well for your name, it’s practically worthless for your keywords. That’s why some commentators put keywords in the name field, but they risk being marked as spammers.

I understand people’s desire to get the best value from their link, but I’m tired of answering comments with “Hi Miami Hotels”. I’d like them to leave their name, without it effecting their keyword benefit. Enter KeywordLuv…

By using KeywordLuv (and a Dofollow plugin) you give your commentators better links, rewarding them and encouraging more people to comment.

DoFollow

For your commentators to benefit from KeywordLuv, your blog requires a separate Dofollow plugin to remove the nofollow tag. KeywordLuv does not do this and without it, your commentators will not receive any benefit.

While KeywordLuv could remove the nofollow tag, there are many existing plugins that do this AND provide advanced features I don’t want to replicate.

Requirements

WordPress 2.2+ (tested on WordPress 2.5, 2.3 and 2.2).

Compatibility - DoFollow Plugins

KeywordLuv hasn’t been tested with most DoFollow plugins but problems are very unlikely. If you do encounter any, please let me know.

Compatibility - WordPress Themes

There is a compatibility issue with some themes. If your theme uses comment_author_link() to retrieve the comment author link, KeywordLuv will work fine. If it uses comment_author() and comment_author_url() to build the comment author link, then it will do nothing.

This issue, along with the possible workarounds, is outlined on the KeywordLuv - Theme Compatibility Issue page.

Note: If you use Brian’s Threaded Comments or YATCP for threaded comments, KeywordLuv will work, as these both use comment_author_link().

Installation

  • Download the keywordluv-1.03.zip file and unzip it.
  • Upload the keywordluv folder to the wp-content/plugins folder.
  • Activate the KeywordLuv plugin within WordPress.

Upgrade

  • Download the keywordluv-1.03.zip file and unzip it.
  • Upload the keywordluv folder to the wp-content/plugins folder, overwriting the existing files.

Usage

When your readers leave a comment, they should leave their name and keywords in the Name field, using the following format: name@keywords.

When posts are displayed, the plugin searches for the @ character, strips it out and moves the name to front (outside the link).

Telling Your Commentators

This plugin is really to help your commentators, so you need to tell them how to use it. By default, the plugin adds a message to the comment form telling users to enter YourName@YourKeywords in the comment field. You can customise this message in the KeywordLuv options page in the Admin area.

Note: This message does not appear if you are logged in, as logged in users normally don’t have a Name field to enter YourName@YourKeywords into.

The problem with this message is that there is no way to control exactly where it will appear. It depends on your theme. In some themes, it may not appear at all.

If you are comfortable editing your theme, the best solution is for you to disable the message (in the KeywordLuv options page in the Admin area) and add your own message exactly where you want it (in comments.php).

If You Disable The Plugin

Whatever the commentator enters in the Name field is what’s actually stored in the database. KeywordLuv simply changes the way it’s displayed. If you decide you no longer want to use the plugin, simply deactivate it and commentator’s names will revert to what’s in the database.

For example, if they enter “Stephen@Custom WordPress Plugins”, that’s what’s stored. If the plugin is active, it will display:

Stephen from Custom WordPress Plugins Says:

If the plugin is disabled, it will display:

Stephen@Custom WordPress Plugins Says:

Support

This plugin is officially not supported (due to my time constraints), but if you leave a comment below or contact me, I should be able to help.

Rate this:
3.4

If you enjoyed this post, make sure you subscribe to my RSS feed!

Plugin Deactivation Issues Solved With Actions and Filters

When Jeff wrote about plugin deactivation breaking your blog, Aaron and I wrote in the comments of a few solutions to prevent plugin issues with themes.

Within this post I will present several techniques plugin and theme authors can take in order to prevent deactivation issues.

Method 1: function_exists

In this example, let’s assume we have a function named related_posts.

When in a theme, we could use this code to call the function if only it exists.


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

The PHP function_exists checks for the existence of the function, and if it does exist, it calls the function.

Method 2: function_exists and Actions

Using the same function name, the theme author could add some code into their functions.php file and use an action and function_exists combination.


if (function_exists('related_posts')) {
	add_action('my_related_posts', 'related_posts');
}

In the above example, we create a new action called my_related_posts.

The end user would use the do_action function where he wants the function used:


<?php do_action('my_related_posts'); ?>

Method 3: Actions

To use pure actions, the plugin author would have to take the initiative and add associated actions to their plugin code.

The code would look very similar to method 2, but would be included in the plugin file.


add_action('my_related_posts', 'related_posts');

The end user would then do the simple do_action call.


<?php do_action('my_related_posts'); ?>

Method 4: function_exists and Filters

Say, for example, there’s a plugin with a template tag that returns some code that you can then echo out in a theme.

Let’s pretend for a minute that the related_posts function could return a string instead of automatically spitting out the code to the screen.

In this case, the template author could add some code into their functions.php file.


if (function_exists('related_posts')) {
	add_filter('my_related_posts', 'related_posts');
}

The end user would then add the following to their theme:


<?php $s =  apply_filters('my_related_posts'); echo $s; ?>

Method 5: Filters

Again, the plugin author would have to take the initiative to only use filters. The plugin author would add the following to their code.


add_filter('my_related_posts', 'related_posts', 1, 2);

The above filter has a priority of one and accepts two arguments.

The end user (aka, theme tweaker), would add very similar code as used in method 4.


<?php $s =  apply_filters('my_related_posts', 4,10); echo $s; ?>

Method 6: Actions and do_action_ref_array

Let’s assume the plugin author has added in the appropriate code to their plugin:


add_action('my_related_posts', 'related_posts', 1, 1);

The above related_posts action just adds an action at priority one, which accepts one argument.

The themer could then add a reference to this action using the do_action_ref_array function.


<?php do_action_ref_array('my_related_posts', array(3,20)); ?>

Assuming the my_related_posts action takes two arguments, we use an array to pass the necessary arguments.

Conclusion

As mentioned in the introduction, it’s the plugin or theme author’s responsibility of adding in the necessary actions and filters so that the end user can deactivate plugins without any major headaches.

The methods I mentioned are not exhaustive, and can be far more advanced if need be. If you have any questions, please leave a comment.

For any code, please use Pastebin and provide a link.

Source : Weblog Tools Collection

Rate this:
2.5

If you enjoyed this post, make sure you subscribe to my RSS feed!

What to Do If Plugin Deactivation Breaks Your Blog

Say you just disabled a plugin, and now your WordPress blog’s front-end says “Fatal error: Call to undefined function.” Part of your site may even be missing.

The problem is that your theme is calling on the plugin you deactivated. However, since that plugin is gone, the site displays an error and then stops rendering the rest of the page.

Here’s what to do:

  1. Go to your WordPress administration. Click “Design” (or “Presentation”), then click “Theme Editor”.
  2. Where on your site did the error appear? If it was on your sidebar, click “Sidebar.” If it was only on a search page, click “Search Template.” If it was in the comments section, click “Comments,” etc.
  3. Now look for a function call that might be related to the plugin you just deactivated. For example, if you deactivated the Related Posts plugin, you might see some code like this:
    <?php related_posts(); ?>
  4. If you don’t plan on using the plugin again, and if you’re sure the code belongs to the deactivated plugin, just delete the code.Or instead, you can follow these instructions to alter the plugin function call so that it won’t break your blog when the plugin is deactivated.

    (If you’re new to theme editing, you might want to backup your theme first just in case.)

  5. When you’re done, click the “Save” button to save your changes.
  6. If you couldn’t find any relevant code, or if the problem still isn’t fixed, repeat steps 3-5 for the rest of your theme files.

If all else fails, reactivate the plugin to get rid of the error, and then consult the plugin’s documentation, contact the plugin author, or file a support request at the WordPress Support Forums.

Source : WordPress Expert

Rate this:
2.5

If you enjoyed this post, make sure you subscribe to my RSS feed!

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.

Source : Hack WordPress

Rate this:
2.5

If you enjoyed this post, make sure you subscribe to my RSS feed!