24 Feb 2016

couch mode print story

What Exactly is WordPress MultiSite (WPMS) Install

If you’ve ever wondered what people are talking about when they mentionWordPress Multisite then please read on. This brief article will explain what WordPress Multisite is, and also some of its concepts and features.
WordPress multisite, sometimes abbreviated as WPMS,  is defined in wordpress.org as:
Multisite is a feature of WordPress 3.0 and later versions that allows multiple virtual sites to share a single WordPress installation. When the multisite feature is activated, the original WordPress site can be converted to support a network of sites.
In other words WPMS gives you the ability to have multiple individual sites within one WordPress installation and one database which all fits under the umbrella of what is known as a network.
So when talking about WPMS it is common to refer to the whole multisite installation as the network. The term site is usually used when talking about each of the individual sites within the WPMS network.
The individual sites created within the WPMS network are also sometimes known as “virtual” sites because they don’t actually exist in the file system but only the database.
Each site within the network can feature different plugins and themes and have completely different content – just like a separate, independent single site WordPress installation.
WordPress multisite was once known as “WordPress MU” where MU stands for “multi user” and was a separate project to the main “single site” WordPress platform which we all know and love so much today.
However since 3.0, WP MU has been renamed to WPMS and is now part of the core WordPress platform.
WPMS is not enabled by default when you install WordPress and you must explicitly set a parameter in the “wp-config.php” file in order to see the WPMS menu items.
Possibly the best example of a large-scale site using WordPress multisite is wordpress.com.
This site allows people to set up their own blogs and does not require that you have a dedicated host because each individual site is hosted within the wordpress.com multisite network.
There are currently something like 30 million blogs running under the wordpress.com WPMS network and the general features available for the individual blogs are controlled by the main site administrator.
Some typcial scenarios where the multisite functionality is useful and is currently widely used, are:
  • Retail stores which represent a single company and which may be located in several cities or states could each have their own dedicated site under the main WPMS  insallation. For example Best Buy uses WPMS where each store has its own WP site within the network.
  • Institutions such as universities often use WPMS to represent their various departments and faculties on separate sites.
  • Online news sites are another typical candidate for WP multisite. Each of the departments such as the main news, sport, finance, etc typically would have their own sites within a multisite network.
  • You might be a theme developer and wish to show your customers a live demo site for each of your themes. Therefore you could create a network of live demos within WPMS.
  • You might decide to set up a collection of blogs for your family and extended family, and thus WPMS might be a cool way to collectively run and maintain all of your family’s sites.
As you’ve probably already surmised, the possibilities available to you with WPMS are endless and not limited to the brief examples given above.

What are the main pros of multisite?

As you may have already guessed, multisite has some very useful advantages some of which are listed below.
  • The most obvious advantage of running a multisite installation is that there is only a single installation of the WordPress platform which you need to maintain.Even though the WPMS installation may have hundreds of sites running within it, you only need to update plugins and theme versions in a single place and this will automatically apply to all of the sites.Imagine if you didn’t have multisite and you had to do separate plugin updates or installations to over a hundred single site installations – you would have to repeat each task over a hundred times!
  • As an administrator of a multisite installation, you can easily set and lock down administration functionality that your network users have for things like plugins or themes. For instance you can quite easily prevent people from deactivating, upgrading or even using certain plugins or themes from within their site.
    You can also set and control disk usage per site and specify maximum file size uploads per site and even specify which filetypes are allowed to be uploaded.
  • You can easily aggregate content from each of the individual sites into your main blog site within a WPMS installation. This can useful for things like showcasing content from a number of the individual sites.

What Types of URL Addresses Are Possible With Multisite?

With multisite you basically have 2 main installation types which govern how the URL addresses will appear to the outside world:
  1. Sub-domains
    With this setup, each site will have a URL address which appears like the following:
    site1.example.com
    site2.example.com
    site3.example.com
    etc,
    Where example.com would be the URL of the main WordPress installation.
  2. Sub-directories
    This type of setup will produce URL addresses for each site as follows:
    example.com/site1
    example.com/site2
    example.com/site3
    etc
For a new and fresh WordPress installation either of the above two types are easily configurable at installation time. However if you’re trying to convert an existing single site to multisite, there are certain criteria which need to be met in order to have the ability to choose the sub-directories option. (Please see the WordPress codex page for more info)
There are even plugins which make it possible to use domain mapping to produce URLs for each site which would make them appear to outside observers that the site is not part of a multisite installation.
For instance you could make the URLs for each site look like single independent sites, eg, abc.com, xyz.com, etc

Some Limitations of WPMS

Previously we mentioned that WPMS uses a single database.
Each site in a WPMS network has its own tables which contain the data for that site.
A WPMS installation has a slightly different DB schema to single sites. The tables of a site in a WPMS installation are prefixed by the table prefix followed by the blog ID followed by the table name.
For example the following shows the possible table names of two sites in a multisite install:
Site 1Site 2
wp_1_commentmetawp_2_commentmeta
wp_1_commentswp_2_comments
wp_1_linkswp_2_links
wp_1_optionswp_2_options
wp_1_postmetawp_2_postmeta
wp_1_postswp_2_posts
wp_1_termswp_2_terms
wp_1_term_relationshipswp_2_term_relationships
wp_1_term_taxonomywp_2_term_taxonomy
Due to this type of setup, it is very easy to quickly use up server resources if you tried to run a WPMS with thousands of sites on a small shared host. Therefore you would need to take such things into consideration when setting up your WPMS installation.
In summary, WPMS is a very powerful WordPress feature and one that you might want to consider.
Now that you know all about WPMS, go ahead and follow our WordPress multi-site installation tutorial to set one up :)

couch mode print story

5 Tips On How To Make Your Blog Visitors Stay Longer

The length of time that you can keep your visitors on your website can be a crucial factor in determining how successful your blog will be.
Simply getting traffic in the form of thousands of unique visitors daily is meaningless if the time they spend on your site is less than a few seconds or your bounce rate is more than 95%.
There are certain things you can do in the way you present your pages and posts which will maximize the chances of your visitors sticking around for a longer period on your site.
The longer people stay the greater your opportunity to monetize their visit or convince them to take your desired call to action.
call to action is an Internet marketing term which refers to the primary action that you want your visitors to take when they land on your page or website. One example of a call to action  is where you want someone to click your “buy now” button and purchase your product. Another might be that you want to get people to download your free ebook after signing up as members.
Below are some tips which will help you to keep the attention of your visitors or at the very least keep them interested long enough to stay and explore your site and ultimately perform the call to action you want them to.
  1. Remove unnecessary external links from your landing pages and use internal linksTrying to increase the average visitor time on your site is one of the ways that you can decrease your bounce rate and increase your rankings.If you use Google Analytics you’ve probably already heard of the term “bounce rate”.Bounce rate (as defined by Google) is:“..the percentage of single-page visits or visits in which the person left your site from the entrance (landing) page”.
    Therefore plastering your affiliate banners and links all over your pages can work against you if your visitors leave your site immediately from the page they entered from.
    Try to entice your visitors to read more by offering them some relevant links to another internal page or post where you provide a useful review and which ultimately contains your affiliate banner. This way you are not pushing people straight out of the same door they entered.
    There are some useful WP plugins you can use to add relevant internal post links to your blog such as Yet Another Related Posts Plugin.
  2. Use emotion to present your messagePeople most often buy from emotion whether they admit it or not. This is because the actions which emanate from emotion are quite often subconscious.
    Hence, an emotional response is much more likely to achieve a call to action than a logical one.For instance if you are trying to convince someone to buy your product by using logic, then the chances are that they will also look at your argument from a rational point of view and they will weigh up the pros and cons of buying versus not buying.If you introduce an emotional element to your message such as presenting a benefit or selling a solution to a problem or highlighting how people can get closer to achieving their dream, then you will appeal to the emotional decision making areas of the brain.
    This will maximize the chances of gaining a customer because it will create an emotional connection between your message and the reader.Therefore once you have successfully forged a positive emotional relationship with your readers, they will happily want to come back to your site to explore further or even become regular customers.
  3. Include video content on your posts and pagesVideo is one of the most effective ways to communicate a message to people. Even short videos of just a few minutes can often deliver more value to your readers than multiple pages of writing can.
    Therefore in the cases where you would usually get people browsing through an article in 10 to 20 seconds before leaving, the added benefit of using a short video is that it increases the likely-hood that people will stay on your site for longer because they are watching your video.
    Video on the Internet is really just a modern extension of TV but the great thing is that you get to be the producer of the content.
  4. Use captivating images in conjunction with your copy or content
    Quite often the right image coupled with the relevant content can induce an emotional response and it can help lay the foundations for the right mindset you want to create before somebody reads your sales pitch or post.
    Humans are quite easily visually stimulated and you can exploit this by using effective images and colors with your message.
  5. Focus on providing value and informative content rather than blatant advertising
    Your content and the value which it provides is the sticking point which helps to build a relationship with your readers. A relationship needs some measure of trust by both parties but when you successfully gain this trust from your readers or clients then you are also creating a longer term investment where current customers also become future customers.There are many ways you can provide value for people who will in turn be very happy to return the favor by becoming a customer. For instance you could offer free online courses or a series of tutorials which people can access after they sign up as free members.
    You could also set up your own forum or support system which provides help to people but also an opportunity for people to interact with each other.

couch mode print story

Understanding the Importance of Landing and Sales Pages

Relevance is the most important factor when you are advertising on the Internet.
The more relevant the keywords are to your ad text and your product or service, the more likely the ads will be to get clicked on by users who are actively searching for you and your business.
The landing page is the page specifically designed as the entrance point for the users that click on your ad or contextual link and its job is to convince them to perform the relevant call-to-action which you want them to.
But the biggest downfall of any Adwords or advertising campaign in general is when users land on poor quality or irrelevant landing pages.
Spending money on Adwords and other advertising campaigns without having a proper landing page is like throwing money down the drain.
Landing pages are one of the key components as part of your overall marketing strategy which you should strive to get right. After all, the primary purpose of landing pages is to turn visits into conversions.
The landing page is where all of the magic happens after you’ve spent hours of SEO work and spent hundreds and sometimes thousands of dollars just to get visitors to your page.
It therefore makes sense that you do as much as you can to convince your visitors to do what you want them to do once they hit your landing page.

What makes an effective landing page

Landing pages are the key last step to your advertising campaigns and the crucial first step for your visitor’s experience when they arrive to your site.
The quality of your landing pages affects more than just your conversions.
For instance if you have an Adwords campaign, the Quality Score is a Google variable which determines where your Adwords ad will show up on a search page and how much you will pay per click.
A high quality landing page will obviously have a higher quality score and hence a lower cost per click which will also improve your Return On Investment (ROI) because your conversion rate will be better.
Conversely if you have a low quality landing page, you’ll spend more money per click and suffer lower conversions.
Below are some factors which Google deems important in determining the quality of a landing page but which are also a good practice to get into when designing your site’s pages in general.
By taking precautions to satisfy the qualities below, you will go along way in helping improve your site and Quality Score with Google.

1) Relevance

A landing page has to be explicitly relevant to the keywords you use in your particular ad or link.
In other words a generic page such as your home page would not be considered a good landing page unless you are hosting a one-page site. (Note: Google has been known to dis-favour one-page sites in the past so if you are thinking of undertaking this practice you should do it at your own peril)
For instance if you send somebody who has just clicked on an ad specifically about “cat grooming accessories” to your generic pet-care homepage, you are not providing them with the specific information they need and you may lose them from your site.
In other words, if you force somebody to search for what they are looking for once they arrive on your site after clicking an ad which promised certain information, then you will only confuse and frustrate them and eventually each visit will lead to a dreaded page bounce.
Even worse, if you are running a google Adwords campaign, your ad may be penalised as being less relevant than your competition, or your Adwords account can even be suspended in extreme cases.
The best landing page for the scenario above is that when somebody has clicked on an advertisement about “cat grooming accessories” they will be taken directly to your page which showcases all of your cat grooming accessories.
In this case the user has received exactly what they asked for but it doesn’t mean that they can’t visit other pages in your website – because a good landing page also has navigable items which offer your visitor pathways to other areas of your website. (see more about navigability below)
But the main essence of your landing page is that it specifically provides the information which was promised in the keywords of your advertisement.

2) Originality

It’s always a good idea to provide original content on your landing pages.
When you provide original content, you are helping to differentiate your landing page from the rest of your competition.
Offering something relevantly unique to your site’s visitors can greatly sway the conversion rate in your favour.
The same or similar looking landing pages with the same old content don’t provide much value to web searchers and Google will eventually mark down such sites accordingly by demoting their position in search results.

3) Transparency

An important factor for any web-based business is to build trust with your visitors.
One of the best ways to do that is by being transparent.
Make sure that you are clear about the purpose of your business and website and also how you handle any private information which you might be collecting during your interactions with your visitors.
To create a site conducive to feelings of safety, security and trust, you need to make sure that you provide information about data security, privacy policies and clear terms and conditions.
Your landing page should offer this transparency in the form of easily locatable links or menus.

4) Navigability

When a visitor arrives on your site’s landing page, apart from being presented with the content they were promised when they clicked the ad or link, they should also be able to easily navigate their way around the page and even your whole site if they so desire.
Your visitors should not be expected to work too hard at performing the call-to-action which you asked them to do. For instance if they came to buy cat grooming accessories, then the buying process should be easy, painless and self evident via the use of things such as clear information and buttons and images.
Also if they wanted to explore other items unrelated to their initial search – such as “dog leashes” instead of cat accessories, they should easily be able to navigate to your other products or information pages.
Clear menus and links or banners in your sidebar or footer are a great way to offer a pathway to your other pages. This way, even though the visitor was specifically looking for “cat grooming accessories”, you are still providing them the option of being able to navigate to another part of your site which offers other products and avenues into different areas of your sales funnel.
When your visitors struggle to find what they are looking for they will get frustrated – and frustrated visitors don’t convert to customers very easily.

Conclusion

So next time you are creating a landing page or revisiting your current landing pages, see if you can add the above qualities as part of your page’s construction.
Apart from being good for your landing pages, the above factors are a good common sense approach to any page on your website because they help enhance your readers’ experience and hence improve your favorability with Google.

couch mode print story

WordPress Action Hooks and Filter Hooks – An Introduction

If you’re learning about WordPress and are thinking of doing some plugin or theme development, then hooks are something which you should become familiar with.
Even if you don’t plan on becoming a fully fledged programmer but simply like to tweak themes to suit your needs, then WordPress hooks are also something which you should be aware of.
In this brief article we are going to introduce you to the two types of hooks which are used in WordPress and how you can identify them.
We will also briefly look at you how you can leverage hooks to insert customised code in order to achieve some new functionality.

So what are WordPress hooks?

To put it simply, a “hook” is a certain location in the WordPress code which allows you to attach or run your own code. The word “hook” is an apt description because it literally conveys the act of hooking onto something – in this case hooking your code up to the core code of WordPress.
Another way of describing WordPress hooks is that they are sort of like designated areas within the WordPress code which give you the opportunity to execute your own functions.
If you decided to write a WordPress plugin or if you wanted to develop a theme, then it is almost certain that you will write code which will contain functions which utilize one of the many hooks available in WordPress in order to achieve your desired functionality.
In WordPress there are two types of hooks – Action Hooks and Filter Hooks.
Let’s briefly look at each one.

Action Hooks

Action hooks allow you to execute your custom functions which are referred to as actions.
Action hooks allow you to add additional code to the WordPress core or theme so that you can achieve some new functionality or customizations.
The actions or functions which you would write for your plugin or theme can be run wherever there is a hook available – which may be during the WordPress loading stage or when certain events occur.
Some examples of events where you might want to execute an action are when someone publishes a blog post or when a certain type of page is being viewed.
Each of these “events” will contain an appropriate hook onto which you can attach your action (or function) to.
The definition of action hooks as stated in the WordPress documentation is:
“Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.”
So what does an action hook look like?
In the WordPress core system hooks are usually created by writing a function which contains inside of it a command which represents the particular hook.
Let’s look at an example of a very commonly used action hook called wp_head which is used by many plugins and themes to add things such as meta data between the <head> </head> tags of a WordPress page:

function wp_head() {
do_action('wp_head');
}

(Note: The above snippet was taken directly from the core WordPress code in the file wp-includes/general-template.php).
The tell-tale characteristic which identifies the above code as an action hook is the presence of the function:

do_action('wp_head');

In other words, the do_action function is how the ‘wp_head’ action hook is created.
A generic way of representing an action hook is:

do_action($tag, $args)

where:
$tag = the name of the action hook (eg, wp_head)
$args = optional parameter(s) passed to the actions (or functions written by you) which register with the particular action hook. Action hooks can have many or no parameters such as the wp_head example shown above.
(Note: You should consult the WordPress code to determine if or how many parameters an action hook has)
Another way you might see an action hook created is via the following function:

do_action_ref_array( $tag, $args );

The above function differs slightly to the do_action function in that the $args variable represents an array of parameters which are mandatory.
Without going into the technical details too much, it is simply enough to know that whenever you see a do_action() or do_action_ref_array() function, then you know that you are dealing with an action hook.
So now we know what action hooks look like, how do we write actions which we can use to hook into these hooks?
When you are writing your custom functions for your plugin or theme, you would typically hook your code into an action hook using a statement like the following:

add_action( 'action_hook', 'your_function_name' );

The above line tells WordPress that you would like to execute your function called your_function_name when the system comes across the action hook called action_hook.
Below is a simple example of using an action hook by creating an action:

<?php
add_action( 'wp_head', 'my_actionhook_example' );
function my_actionhook_example() {
echo '<meta name="description" content="Hello world. This meta description was created using my action hook example." />' . "\n";
} // The end of my_actionhook_example()
?>

The above code is something which you might place in your theme or child-theme’s functions.php file and when it is executed it will simply echo a meta tag inside the head portion of a WordPess page.
The add_action line registers (or hooks) your action (called my_actionhook_example) to the action hook which is called wp_head.
If you recall from earlier we said that an action is a customized function which you create and in the example above you can see the function definition and the code for the function which simply adds some meta data.
The example we’ve just seen uses one of a large number of action hooks available to you in WordPress and is a small drop in the ocean with what you can do with action hooks.
If you are curious and want to discover more of the action action hooks available you can do a global search through the WordPress core code for the following two strings using a code editor:
do_action
do_action_ref_array
The search results yielding the above terms will contain the action hooks built into WordPress where the first parameter will be the action hook name.
Also don’t forget that the WordPress documentation and codex is also a great source of information about hooks too.

Filter Hooks

Filter hooks are another type of WordPress hook and these deal with the manipulation of text and other output.
When defining filters the WordPress documentation says:
“Filters are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data (such as adding it to the database or sending it to the browser screen). Filters sit between the database and the browser (when WordPress is generating pages), and between the browser and the database (when WordPress is adding new posts and comments to the database); most input and output in WordPress passes through at least one filter. WordPress does some filtering by default, and your plugin can add its own filtering.”
So in a similar way to action hooks, filter hooks allow you to also execute your functions known as filters.
As we saw from the definition, the main purpose of a filter is to modify settings or text of various types before “adding it to the database or sending it to the browser screen”.
A filter hook can be identified by either of the following pieces of code:
  • apply_filters( $tag, $value );
  • apply_filters_ref_array( $tag, $args );
For example in the WordPress core you will find a line of code like the following:

$title = apply_filters('wp_title', $title, $sep, $seplocation);

The above example shows the creation of the wp_title filter hook. This hook allows you to manipulate a page’s title before it is displayed in the browser.
As for the action hooks, filter hooks follow a similar pattern. The $tag represents the name of the hook and there are also parameters which are passed to filters which are registered to the hook.
Unlike the do_action hook, the apply_filters hook will always pass a parameter to the filter (which is the customized function you write) and your filter in turn must always return the $value parameter back to WordPress.
To create and register a filter you will use a similar approach to creating an action. For example you will write a function (known as the filter) which does something and you will also register your filter to a particular hook using a command such as:

add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] );

where:
  • hook_name = name of the hook you want register to
  • your_filter = the name of your filter (or function)
  • priority = (optional) integer which represents the order your filter should be applied. If no value is added, it defaults to 10.
  • accepted_args = (optional) integer argument defining how many arguments your function can accept (default 1) because your filter must accpet at least one parameter which will be returned.
Let’s look at a simple example of creating and registering a filter.
The code below shows something you might add in your customized theme functions.php file to append the site name to a page’s title:

<?php
add_filter( ‘wp_title’, ‘mytest_add_sitename_to_title’, 10, 2 );
mytest_add_sitename_to_title( $title, $sep ) {
/* Retrieve site name. */
$name = get_bloginfo( ‘name’ );
/* Append site name to $title. */
$title .= $sep . ‘ ‘ . $name;
/* Return the title. */
return $title;
}
?>
We can see from this example that we are registering our filter which is called mytest_add_sitename_to_title to the wp_title filter hook and we are assigning a priority of 10 and specifying that our filter function will accept 2 arguments.
Also note that our filter returns the $title back to WordPress in order for it to be able to display the modified title to the screen.
In summary we’ve only just scratched the surface regarding hooks and their uses.
I hope that this introductory article has at least begun to demystify the subject of hooks and given you a small taste of what they are about and how you can identify and use them.
As always the WordPress codex and documentation pages are a very good place to start when you want to develop a deeper understanding of hooks.

couch mode print story

Some Useful Things About WordPress Which You Should Know

Straight out of the box, WordPress is an amazingly effective content management system and blogging platform.
Within its core PHP interior resides functionality which makes it the most flexible and easy to use platform for creating websites ranging from the simplest blog to a full blown business eCommerce site.
The majority of the WordPress functionality is clearly visible and accessible from the user interface in the administration panel.
However there are also some other less obvious but powerful functional features which are available when you delve a little deeper into the WordPress internals.
This article will introduce you to two common and useful functional features of WordPress which you should be aware of.

WordPress Template Hierarchy

WordPress uses a hierarchical template structure which determines how it renders any particular page or view for your currently active theme.
The mechanics of this hierarchy are quite simple. WordPress will automatically check for the existence of certain template files in your theme folder in a pre-determined order whenever it is trying to render a particular page or view.
For instance let’s take the example of a WordPress page.
Before rendering any “page”, WordPress will check for the following templates in the order shown until it finds one and it will then display the page according to the code in that template file.
If all checks fail it will simply display the page according to the index.php which is the last check in the hierarchy.
The hierarchy of template files for a page is as follows:

{custom-template}.php → page-{slug}.php → page-{id}.php → page.php → index.php

As you can see from the above, the default “page.php” is well down the list in terms of page template hierarchy and therefore there is plenty of scope for you to customize your theme’s pages by creating your own templates.
For example let’s say we had a page called “Products” with a slug by the same name.
If we wanted to automatically display such a page in a customized manner, then we can create a template file called “page-products.php” and place it in our theme directory.
In this file we would write our code specifying how we want this page rendered. For instance we might want to remove any footers or sidebars or display a list of post excerpts which are in a particular category.
WordPress will then automatically render the “Products” page according to the code in the page-products.php template file without any other configuration on our part.
A similar mechanism is also available for other view types such as categories, posts, tags etc
For the category group, the template hierarchy is as follows:

category-{slug}.php → category-{id}.php → category.php → archive.php → index.php

Some other template hierarchies are shown below:
Single:
single-{post-type}.php → single.php → index.php
Author:
author-{author-nicename}.php → author-{author-id}.php → author.php → archive.php → index.php
Tag:
tag-{slug}.php → tag-{id}.php → tag.php → archive.php → index.php
Exploiting the template hierarchy characteristic can be a useful and powerful way to extend the functionality of your theme and how it displays particular pages.
For more about creating your own page template see our post “How to Create a Custom WordPress Page Template”.
For an in-depth technical overview of templates please see the WordPress codex documentation.

WordPress Child Themes

Another powerful and useful feature of WordPress is the Child Theme functionality.
As defined in WordPress.org, a child theme is:
“a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme”
For example let’s say you recently found what you thought was the theme of your dreams and you installed this new theme on your site only to find that you wanted to change some of its appearance or functionality.
Instead of hacking the theme’s code and then having to worry about remembering to put the changes back every time you update the version, creating a child theme is often the cleanest and easiest option.
To make your own child theme you simply create a new folder in the /wp-content/themes/ directory with your child theme’s name.
For example if you wished to modify the twentyeleven theme and wanted to create a child theme called twentyeleven-plus then you would create the following directory:
/wp-content/themes/twentyeleven-plus
The only mandatory file needed for a child theme to work is the style.css file which you would create in your child directory.
You must use a convention when creating your style.css file whereby the comment at the top of the file must be in a certain format (see example below).
The following is an example of a typical style.css file for a child theme:

/*
Theme Name:     TwentyEleven-Plus
Theme URI:      http: //example.com/
Description:    Child theme for the Twenty Eleven theme
Author:         Your Name Goes Here
Author URI:     http: //example.com/about/
Template:       twentyeleven
Version:        1.0
*/
@import url(“../twentyeleven/style.css”);
The comment section shown above contains two important mandatory fields:
Theme Name – this is the name of your theme which will appear in the Appearance → Themes page in the WordPress administration panel. This must match the name of your child theme’s directory (case insensitive).
Template – this is the name of the folder of the parent theme from which your child theme will inherit its qualities.
The other fields are optional but it is still a good idea to put some useful information here because these are also displayed in the administration panel of WordPress.
The last line shown above which is not part of the comments is the “@import url(“../twentyeleven/style.css”);” statement. This is also optional and is usually a good idea to include, especially if you wanted to implement some tweaks to the parent theme’s original style.css file.
This line tells WordPress to import the parent theme’s style.css file which means that if left unchanged, your child theme would render the CSS according to the code in the parent’s style.css.
However if you added some CSS code after this line, then the code for the particular CSS element will override the code for that same element in the parent’s style.css file.
Let’s take an example where we wanted to change the background color of our child theme to a light blue represented by the hex code #cee9f5.
The original code in the parent style.css displays the body’s backgound color as grey as shown below:

body {
background: #e2e2e2;
}

Therefore to modify this element we would simply add the following code at the end of our child theme’s /wp-content/themes/twentyeleven-plus/stye.css file.
Thus the contents of the new style.css will look as follows:

/*
Theme Name:     TwentyEleven-Plus
Theme URI:      http: //example.com/
Description:    Child theme for the Twenty Eleven theme
Author:         Your Name Goes Here
Author URI:     http: //example.com/about/
Template:       twentyeleven
Version:        1.0
*/
@import url(“../twentyeleven/style.css”);
body {
background: #cee9f5;
}
The above code effectively means that WordPress will load the parent’s style.css file but it will override the code pertaining to the “body” element with the new code for the body element shown above.
The cool thing about this is that all of the other existing CSS properties are automatically used from the parent’s style.css except for the body element which will use your new code.
We mentioned earlier that the only mandatory file in a child theme’s folder is the style.css file. This file will allow you to manipulate any CSS element pertaining to your theme.
You can also do something similar with template files. That is, by creating new template files (such as page.php) with the exact file name in your child theme directory, you can override the functionality of your parent theme with your customised code.
What if you wanted to further extend the functionality of your child theme, by adding your own functions to the functions.php?
In contrast to the child style.css and template files, the functions.php works a little differently, in that it does not automatically override the parent functions.php but is loaded in addition to the parent file.
That is, the child functions.php file is loaded first followed by the parent functions.php file.
As for the previous examples you would simply create a new file in your child theme directory with an identical name to the original file, ie, functions.php.
The child functions.php file doesn’t require any special comments at the beginning such as for style.css but you still need to honor the correct PHP syntax by placing your code between the PHP tags when necessary:
<?php  ?>
In this file you can add the code of any new functions which are not already contained in the parent functions.php file.
What if you wanted to modify an existing function contained in functions.php in the parent theme?
For existing functions contained in the parent theme, the general rule is that you are not allowed to re-declare the same function name in your child theme’s functions.php file unless it is a “pluggable” function in the parent file.
A pluggable function is simply one which is wrapped in a conditional statement during declaration in the parent functions.php file.
Eg:

if (!function_exists('theme_special_nav')) {
function theme_special_nav() {
//  Do something.
}
}

The if statement above containing the function_exists() check effectively means that the “theme_special_nav()” is pluggable.
So before you re-declare any existing functions, be sure to check the parent functions.php file if a function is pluggable. (see the wordpress codex documentation for more info)
One other useful trick when creating your child theme is to include a file called screenshot.png in your child theme directory.
This file contains the preview image of your child theme and will be displayed in the Appearance → Themes page of your administration panel.
Although this file is completely optional, it is handy to include because it makes your child theme look more professional.
In summary, this brief article has only touched the surface of child themes and templates and there is so much more you can learn.
I strongly recommend that if you want to know more, you should read some of the excellent information available on the web starting with the WordPress codex documentation.

couch mode print story

What is Akismet and Why You Should Start Using it Right Away


Every WordPress installation comes with two plugins pre-installed. One of them is Akismet, which is definitely in our list of must have WordPress plugins. Even though Akismet comes pre-installed, it is not activated by default. You will have to take some extra steps to activate it. In this article, we will explain what is Akismet and why you should start using it right away. We will also show you how to setup Akismet on your WordPress site.


What is Akismet?

Akismet is a comment spam filtering service. The name Akismet comes from Automattic and Kismet. Auttomatic is the company behind Akismet, and it was founded by the WordPress co-founder Matt Mullenweg. Akismet catches blog comment and pingback spam using their algorithms. This algorithm learns from its mistakes and from the actions taken by participating websites. For example, when a number of websites start reporting similar looking content as spam, then Akismet will learn to identify that kind of content as SPAM in the future. As of June 14, 2013, Akismet has caught more than 83 Billion spam comments.

Why you should use Akismet?

On popular websites, the amount of spam comments could get as high as 85%. This means out of every 100 comments only 15 are legitimate. Comment moderation is a time consuming task, and Akismet can save you hours. Akismet will catch spam comments before it lands in your moderation queue as pending. This allows you to focus your energy on moderating comments by real users.
Criticism by Users
In the past users have criticized Akismet for giving false positives. False positives are legitimate comments that gets marked as spam by Akismet. This can happen for variety of reasons. One of the most common reason is if a user’s comment is marked as spam by a number of blogs, then Akismet would learn to mark all comments by that user as spam. Like any other automated platform, Akismet is not perfect, but it is the best there is.
How to Know if your Comment was Detected as Spam
If your comment was marked as spam by Akismet, then you will not see the Awaiting Moderation notice like you normally would. If you submit a comment on a site, and you do not see your comment text along with a notice saying awaiting moderation, then you should immediately contact the site administrator. They can help pull your comment out of the spam box, and overtime Akismet will learn from its mistakes.

How to Set up Akismet in WordPress

First thing you need to do is go to Plugins and activate Akismet.

Upon activation, Akismet adds a new menu item at Plugins » Akismet Configuration. Clicking on Akismet Configuration will take you to Akismet Configuration screen. On this page, you will be asked to enter your Akismet API Key. Leave this page open and open a new browser window. We will come back to this page after creating an API key for Akismet.

How to Get API Key for Akismet

In order to set up Akismet on your website, you need an API Key. Go to Akismetwebsite and click on Get a WordPress Key Button.

This will take you to Akismet plans and pricing page. Akismet is free for non-business and personal sites. For business websites, there are different plans and packages available. Choose an option that best suits you. The pricing is setup on honor system, so theoretically you can get away by using a personal plan on a low traffic site. No matter which plan you choose the remaining steps will be similar. Click on the Sign up button to proceed.

Clicking on the sign up will bring you to the next screen where you will be asked to sign up with WordPress.com. WordPress.com is a blog hosting service by Automattic, the same company that brings you Akismet. However, WordPress.com is not the same as your WordPress.org self hosted website.  You can create a WordPress.com account without creating a blog. Click on Sign up with WordPress.com button to continue. This will open a pop up window with a simple sign up form.

If you already have a WordPress.com account, then you can click on the link I already have a WordPress.com account. If you don’t have a WordPress.com account, then simply fill out the details and create one.
Once the authentication with WordPress.com is complete, you will be taken back to the Akismet website. There you will be asked to provide some user details along with the payment information. If you picked the free plan, then simply drag the price amount to $0.

Click the continue button and you’ll be taken to the screen that shows your API key. You will also receive an email from Akismet containing your API Key.

Remember, an API key is like a password. Do not share it with anyone. In case you lose or forget your API key, you can always visit Akismet.com and click on the sign in button to access your account page. After signing in you will see your Akismet API key hidden. Click on Reveal link to display your API key.


Using Akismet API Key in WordPress

Copy your Akismet API key and go back to your WordPress website’s admin area. Go to Plugins » Akismet Configuration and paste the API key. Rest of the options on this screen are optional. Once you click on Update Options button, Akismet will now verify your key and show you a success message:

Showing Akismet Stats on Back and Front-end of your Site

After logging in to your WordPress website, you will see an overview of Akismet Stats. It will show you the number of Spam comments caught by Akismet, and how many of them are in your spam queue right now. It is highly recommended that you take a look at your spam queue every once in a while so that you don’t miss a legitimate comment getting deleted by mistake.

There is a detailed view of Akismat stats available under Dashboard » Akismat Statsmenu item. Clicking on it will show you detailed statistics of spam and ham comments on your website. You can also see the number of spam comments caught by Akismet since you activated it.

If you want to display the number of spam comments Akismet has caught on your website, then you can use the Akismet Widget. Go to Appearance » Widgets, drag and drop Akismet Widget to your sidebar.

We hope this article helped you set up Akismet on your website, get an Akismet API Key and learn why Akismet is important. Spam comments is a big issue faced by many WordPress sites. As your site grow, you will find that you need other options to work along side with Akismet to reduce the amount of spam. For example, you can block spam comment bots in WordPress with honeypot. Since most spammers want to leave spam links on your website, you can remove website URL field from WordPress comment form like we do. We have also compiled a list of tips and tools to combat comment spam in WordPress. For questions and feedback please leave a comment below.