Category Archives: Wordpress

How-to for Wordpress

Creating WordPress Short Code

If you need to create a short code for WordPress, you shouldn’t be reluctant. The following short code handling could be created as a plugin, but, this handling will be installed as if it were intended to be part of a theme. As a result, instead of being added as a plugin, it should be inserted in the functions.php in the theme directory. Remember, a functions.php file in the themes directory will be available just as if you had added it to the functions.php file in WordPress, but, your changes will not be lost with an upgrade of WordPress.

Creating a WordPress short code is easy. The following is an example of creating short code.

This short code creates a button for WP e-commerce to allow the visitor to click the button to order a product and immediately be dropped at the checkout page. This cuts a step out of the ordering process of a simple item in WP e-commerce.


/**
 * Custom shortcode function added to create a button that adds
 * a product to cart and takes customer directly to checkout page.
 *
 * Usage:
 *   [add_and_go_to_checkout class='my_button_class' 
 *       id=1 name='buy_my_product' value='Buy My Product' 
 *       image='image.jpg']
 *
 */
function wpsc_add_and_go_to_checkout_shortcode($atts) {
    // build form for button
    $shopping_cart_url = get_option('shpping_cart_url') ;
    $output = <<<GOTOCHECKOUTSELECTION
      <form class='go_direct' action='{$shopping_cart_url}' 
	     method='post'>
        <input  type='hidden' name='wpsc_ajax_action' 
	     value='add_to_cart'>
        <input  type='hidden' name='product_id' 
	     value='{$atts["id"]}'>
        <button type='submit' id='product__submit_button' 
	     class='{$atts["class"]}' name='{$atts["name"]}' 
         value='{$atts["value"]}'>
        <img src='{$atts["image"]}' alt='submit'></button>\\n">
      </form>
GOTOCHECKOUTSELECTION;
    return $output ;
}
add_shortcode( $tag = 'add_and_go_to_checkout', 
               $func = 'wpsc_add_and_go_to_checkout_shortcode') ;

Therefore, by using “add_shortcode,” creating a simple function, and add the function and add_shortcode command to the functions.php file in your theme directory, you can create a helper short code that meets the needs of your WordPress site.

9 Must Have WordPress Plugins

WordPress LogoIf you use WordPress, you should know about plugins. Plugins help expand and customize your WordPress site. Plugins add new functionality to your site.

Here is a list of widgets to get you started with your SEO, security and site function. You should really consider these tools to help you with your WordPress site.

  • Wordfence Security
  • Contact Form 7
  • Hashcash for Contact Form 7
  • redirection
  • wp-complete-backup
  • tinymce-advanced
  • Custom Meta Widget
  • Google Sitemap Generator
  • Google Analytics

Here is a quick summary of why you should consider these plugins:

  1. Wordfence Security

    This plugin will enhance your security and surprise you. This plugin includes a firewall, anti-virus scanning, malicious URL scanning and live traffic monitoring. You will feel more comfortable knowing that you have virus checking, and be fascinated by who is crawling and attacking your site. The tool includes malicious IP and Network blocking, scans for backdoors, locks out brute force hacks and much more. I think you will love it.

  2. Contact Form 7

    If you would like a contact form, try Contact Form 7. This is a great contact form. Never expose your direct email address on your website, use a web-form. Showing your direct email address may result in spammers identifying your email address and make your email the target for tons of trash. Contact forms provide a method for people to find you, yet, helps protect you from spammers.

  3. Hashcash for Contact Form 7

    I know, you’re saying to yourself that you have to worry hackers will use an automated submission routine to submit tons of forms to your email address. Some people add a captcha field to their forms to help minimize that problem.

    Captcha fields are those wondrous add-on fields you have seen on forms that requires you to read a sequence of characters or numbers and copy the stuff to a special input on the form. The logic, only humans read, so we eliminate automated submission — what a pain for the filer of the form. Well, try Hashcash for Contact Form 7 with Contact Form 7. This is a plugin that appears to do a great job of filtering out automated form submissions without having to add a captcha field to your form, and without causing the form filer from taking any extra actions.

    Your visitor will thank you for not using a captcha and you will thank this plugin for thinning out your trash mail.

  4. Redirection

    This plugin is essential as your site changes. As your site ages, you may delete or move pages around. You may change page names. Search engines may have search results of your pages by the old name. Search results may return you page at the old address. When someone clicks, they could miss seeing you. Rather than losing the linkage from the search engines, use the redirection plugin to let WordPress know that requests for one page path should now be redirected to the new pages. Using this plugin, when you redirect a path, and a visitor accesses an old path to your page, this plugin redirect to the correct location and sends a message to the search engine that the page has been permanently redirected (301 redirect) to the new address. The permanent redirect will let the search engines to update their search results statistics, and permit people to find the moved page/post.

  5. WP-Complete-Backup

    Guess what, backups are good. If you haven’t noticed, your computer is not the only thing that should be backed up. Using this widget, you can backup you site and database with little effort. Then, you can feel safe that you can restore your website if some hacker does damage and you need to do repairs.

  6. Tinymce-Advanced

    Customize and enhance your WordPress editor. This plugin lets you add new features to the text editor. It’s great what you can add and make your editing easier. Try it.

  7. Custom Meta Widget

    Your website comes with some strange content sitting around on your page. The strange content is on a box labelled “Meta.” This includes links to WordPress.org, has login to your admin and lots of other strange things you may not want. You may want some of the Meta area, content, but, not all. Using the Custom Meta Widget, you can remove any or content you don’t want included in the Meta area. It is nice to clean up your page, getting rid of unwanted links.

  8. Google Sitemap Generator

    If you are not using All-In-On-SEO, or WordPress SEO applications, you should be using Google Sitemap Generator. This will generate a site map and make the Search Engine world happy. Your website should have a sitemap. Sitemaps are important. (Future posts will discuss the top-end SEO tools All-In-One-SEO and WordPress SEO, which both offer sitemap generation (plus much more) and are worthy of your time to consider.

  9. Google Analytics

    You should be using Google Analytics to track the visits to your site and the number of people searching for the types of information you provide. The Google Analytics plugin provides a quick and simple way to add Google Analytics to your site. Set up a Google Analytics account, let Google know your site address and get an account ID. Let this plugin know your account ID and it will automatically set up your WordPress site to work with Google Analytics.

Hope you learned about a plugin or two that you didn’t know about before, and please look back later and see suggestions of other great plugins that will make your life easier.

Pinging and WordPress

WordPress LogoIf you have a WordPress site and would like the world to know when you release a new post, you should have an option for the visitors to subscribe to your site. But, before people will know about your site and subscribe, you have to let the internet know that you have articles for the world to read. Yes, the search engines find your new content eventually, but, you can be proactive. There are many ways to let the world know that you have articles on your site. You can:

  • Post to social websites (such as Facebook, twitter, etc)
  • Join forums to mention your blogs casually (after finding a relevant forum for your site)
  • You can use the 80/20 rule that you spend 80% of your time on other blogs sites getting people to know you as an authority by commenting on blogs, and providing information and content that refers back to your blogs
  • You can ping the world and announce the release of your new articles.

To gain authority in the blogosphere, you should do all these things. This article focuses on the last item … announcing the new post to the world. Ping the world. To ping the world via WordPress, go to Settings/Writing, and head to the bottom of that page. At the end of the page there is an area labelled “Update Services.” In the box within that section, add the list of sites you would like notified of your new post.

Here is a nice list of target addresses to add to your ping list:

http://api.feedster.com/ping
http://api.moreover.com/ping
http://api.moreover.com/RPC2
http://api.my.yahoo.co.jp/RPC2
Continue reading