Blog

WordPress: List all queries on the page

This code snippet will list all the queries executed on your WordPress page
Add this to the bottom of the page:

<?php
if (current_user_can(‘administrator’)){
global $wpdb;
echo “<pre>”;
print_r($wpdb->queries);
echo “</pre>”;
}
?>


WordPress: different CSS for different objects

Site:

body {
background-image:url(‘background.jpg’);
}

Single Page:

body.page-id-78 {
background-image:url(‘background.jpg’);
}

Several Pages:

body.page-id-78, body.page-id-79, body.page-id-82 {
background-image:url(‘background.jpg’);
}

Single Category:

.category-CatName {
background-image:url(‘background.jpg’);
}

Multiple Categories:

.category-CatName1, .category-CatName-2 {
background-image:url(‘background.jpg’);
}

Archive Pages:

.archive {
background-image:url(‘background.jpg’);
}

Custom Template, Post or Category:

.page-template-name {
background-image:url(‘background.jpg’);
}


What do Web Developers Do?

Excellent list of skills required to be a web developer in 2015: See here.


Web Site Objectives

As with any other aspect of your business, you want to know that your website is working for you. Just as you wouldn’t keep spending money on television advertisements or glossy brochures unless they were helping you to achieve your business goals, nor should your website go unchecked. The first step is to clearly understand the purpose of your website and how it meets your business objectives.

Ideally before you spent the time and money building a website you would have thought about why you were doing it. In reality most businesses build a website because they believe that it is a “must” in today’s business environment. Common website formats are –

1) Brochure site. The online equivalent of your company’s brochure. The customer needs to contact the company to conduct a transaction.

2) Ecommerce site. An online shop. Customers can search for products, compare and purchase online.

3) Community site. The company can provides competitions, games or forums for customers to share ideas and stories while gathering important customer insights.

The type of site you have will depend on your business and may include a combination of those listed above. It is very important to keep in mind the reality of your business. If you have a complex product that requires a detailed consultative sales process, it is probably not realistic to have an E-Commerce site.

Now look at your business objectives. See how for each business goal your action plan includes marketing activities to help achieve it? Well, your website is part of your marketing mix. So highlight each business objective that you think can be achieved or assisted by your website. Now you are ready to write your web objectives. You should always use SMART objectives (Specific, Measurable, Achievable, Realistic, Time-specific).

An overview of setting your website objectives might look like this:

1) Clearly define your business goals. Example: “To reduce the average cost per sale by 25%”
2) Identify which goals are best supported by which aspects of the marketing mix, including web. Example: Mail, online and telephone orders have a lower average sales cost.
3) Set your marketing objectives. Example: To have 40% of sales being completed via mail (10%), telephone (5%) and web (25%) by the end of financial year.
4) Break down web specific objectives. Example: To achieve £250,000 (25% of projected sales) via the website by the end of financial year.

In this way, you will have a very clear idea of what your website needs to achieve. Luckily websites are highly measurable so you will have plenty of statistical help to guide you.

We always encourage clients to think first of the busines solution they need and then ask their IT people to create it. Sadly we find most businesses do the opposite – they ask their IT people what they can make and then they try to fit it to their business.

Here are some examples of things you might like to achieve on a business level and some of the web based solutions that can support these goals:

1) Enter new geographical markets (including international) – online shop
2) Create a database of potential customers – e-newsletter subscriptions or online competitions
3) Produce sales leads for your sales people – online appointment booking, email contact, Skype linked phone numbers
4) Reduce sales seminar costs and spread your geographical reach – online live streaming seminars with live video chat.


WordPress, must have plugins

All In One SEO Pack

Out-of-the-box SEO for your WordPress blog.

Contact Form 7

Just another contact form plugin. Simple but flexible.

Google Analytics for WordPress

This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.

Google XML Sitemaps

This plugin will generate a special XML sitemap which will help search engines like Google, Yahoo, Bing and Ask.com to better index your blog.

NextGEN Gallery

A NextGENeration Photo gallery for the Web 2.0.

Display Posts Shortcode

The Display Posts Shortcode was written to allow users to easily display listings of posts without knowing PHP or editing template files.

MapPress Easy Google Maps

MapPress adds an interactive map to the wordpress editing screens. When editing a post or page just enter any addresses you’d like to map.


Set Apache Root Directory

How to Set the Apache Web Site Root Directory

The DocumentRoot directive is used to specify the web server’s root directory, so if you make a request to http://localhost/
Apache will map that address with the directory specified in DocumentRoot.

Open up httpd.conf (in your Apache/conf directory), find DocumentRoot and set it to be your the directory where you want your web site root. If you are migrating from IIS you can put something like this: DocumentRoot “c:/inetpub/wwwroot”

While you are doing this another directive you should set is called the ServerName directive. Set this to be the DNS name of your server (eg servername.company.com ) if you do not have a DNS name you can also use an IP address. Note that the newer versions of Apache preset this value with the installer.


Installing Apache, PHP and MySQL

Our recommendation is to always use XAMPP! Fast and easy to install, either on Windows or Linux, it does all the hard work for you. The 1.8.1 version of the toolset includes:

  • Apache 2.4.3
  • MySQL 5.5.27
  • PHP 5.4.7
  • phpMyAdmin 3.5.2.2

The Control Panel includes service start and stop as well as options to configure and log errors.
To install, download XAMPP from: Apache Friends, use the installer and follow the very simple instructions.


WordPress Shortcut Icon (Favicon)

In HTML, it’s relatively simple to add a Shortcut Icon, you would need to add the following between <head> and </head> in all your html pages:

<link rel=”shortcut icon” href=”http://www.domain.com/favicon.ico” type=”image/x-icon”>The word ‘shortcut’ is not always used (ie; rel=”icon” is ok), it’s added for backwards browser compatibility.

Only type=”image/gif”, type=”image/x-icon” and type=”image/png” are supported in all browsers.

You could do the same in WordPress by adding the above between the <head> </head> tags in header.php in the relevant theme (http://www.domain.com/wp-content/themes/theme/header.php).

However because the page is created dynamically, for correctness, the path is supplied as a variable:

<link rel=”shortcut icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico”>