WordPress Hosting Thanksgiving Offer

A couple month's ago I was looking for a new hosting company for Paulund, it was a long search comparing some of best hosting companies available. I eventually decided on WPEngine, one of the most expensive companies on the list but for a very good reason.

WPEngine

WPEngine is a WordPress hosting company which specialise in WordPress hosting, they will only host WordPress driven websites. When you talk about WPEngine you are talking about the best money can buy WordPress hosting, but this premium WordPress hosting service does come at a price. There starting package is only $30 a month but you are only limited to 25,000 visitors a month, after this you need to upgrade to their middle package which jumps to $100 a month for WordPress hosting, for this you are limited to 100,000 visitors a month.

To start with I thought this price was too much for WordPress hosting but after seeing what you get for this price I had to try it out.

So what do you get for your money?

For $100 a month you can host up to 10 sites with a limit of 100,000 visitors a month.

There are 3 big advantages to hosting on WPEngine:

  • Speed - They are the fastest WordPress hosting company
  • Security - WPEngine helps manage your WordPress install to ensure it is always secure.
  • Support - All employees of WPEngine are WordPress experts to get the best out of your WordPress site. Support is answer extremely quick, if you have a problem I always get an answer within 30 minutes of sending the support ticket.

Thanksgiving Offer November 22nd - November 26th

WPEngine-Logo-300x125

If you sign up for a new WPEngine account during these 4 days with the voucher code blackcyber you will get $25 off your first 3 months of hosting, this means you will get these 3 months hosting for $4 a month.

Bargain!

All you have to do is click the link below, signup with a new account and use the voucher code blackcyber.

Voucher Code: blackcyber

For 3 months of hosting for $4 a month

Sign Up For $4 A Month Hosting

Difference Between PHP Include And Require

One of the most common questions I get asked by PHP beginners is, Why is there 4 ways to include a file on your page?

There is include(), include_once(), require() and require_once().

What do these do? What's the difference between them?

In this article we're going to look at all these different functions and will talk about an example of when you need to use each of them.

PHP include Function

The include function is used in PHP when you want to include a file within the current process. It takes one argument which will be a string to the file path you want to include.

include 'main_page.php';

The code inside the included file will then run when the include function is called.

This can be used in a php templating system where you have a header at the top of the page and the header is going to be the same on all pages. You will put this code inside it's own file and use the include function to add the file to the page.
Continue reading »

How To Change The Language Of Your WordPress Site

When you install WordPress the default language is set to be US English. But this doesn't mean it has to be this language, you can change the language used on your WordPress site to anything you want.

WordPress developers already have the ability to translate themes and plugins using translation files and translation functions.

To find translation files for your language WordPress has built a page on where you can download WordPress in your language.

WordPress In Your Language

Translation Files

To get WordPress to translation all of the text it uses the GNU gettext system, which wraps all the text on the page in a lookup function call. This function will use the language translation file to lookup non-english words and display them in the required language.

The files needed for gettext to translate the text are:

  • POT (Portable Object Template) Translation Files
  • PO (Portable Object) Translation Files
  • MO (Machine Object) Translation Files

Continue reading »

Override WordPress Site URL With wp-config.php

WordPress is a CMS, which means that most of the data is and should be stored on the database. Two of the most important data that is stored in the database is the Home URL and the site URL.

Options Database Table

Along with many other options these two variables are stored in the wp_options database table.

The wp_options table stores all sorts of things you can use to aid the data shown on any of your WordPress themes. Some of the most common options are:

  • Site Name
  • Site URL
  • Site description
  • Admin Email
  • Permlink structure
  • Home page URL

All of these settings can be changed from the Settings section in your WordPress admin area. The wp_options database table is also used to store the values from the settings API.
Continue reading »

Remove Width And Height Attributes From Images

Whenever you upload an image using the WordPress media library and add this image to your post, WordPress will automatically add the image Width and Height attribute in the image element.

This is fine for most themes, but there are other times when you don't want WordPress to add these attributes. The benefit of not adding these attributes is that you can leave any sort of dimensions to the CSS.

If you want to remove these attributes from the image elements it can be done with a simple regular expression search and replace and attach this to two WordPress filters.

  • post_thumbnail_html - Filter any post thumbnails
  • image_send_to_editor - Filter the HTML when adding a image to the editor

Add the following code to remove the width and height attributes from the image elements.
Continue reading »

Understanding The Viewport Meta Tag

When working on a new web design one of things you need to think about is responsive design. Is the website you are about to make going to need a responsive design?

I think all external facing sites should take responsive design into consideration. There are some people who think that responsive design is not worth it as people on mobile devices can zoom in to see what they want, but I feel developers should make a website easy to use on any device.

What Is Responsive Design?

Responsive design is when your website design can adapt to the width and height of the device it is being viewed on. Responsive design is done by using media queries in your CSS file to change the styling of your HTML elements depending on certain breakpoints you setup. Just adding a simple width:100% to some elements is enough to make them responsive when viewed on mobile devices.

The breakpoints define a range of widths which will use different CSS styles. This is typically different sizes of devices such as mobile phones, 7 inch tablets, 10 inch tablets, 13 inch laptops and desktop monitors.

You can define the breakpoints as either pixel widths or min device pixel ratio.
Continue reading »

Use Box Sizing For Easier Widths

Here is a quick tip on working with width's in CSS. There are multiple things that make up the width's of the HTML elements, the width, the padding and any borders on the element.

Total Width = Width + Padding + Border.

This means that if the width of the element is 500px with a padding of 50px and a border of 10px the total width of the element is 620px.

620px = 500px + (50px x 2) + (10px x 2).

Continue reading »

Move Wp-Content Folder To Different Location

Ever since WordPress version 2.6 you can actually move your wp-content directory to a different location. The wp-content directory will store all your theme files, plugin files and images.

Why Move The wp-content Folder

The best reason to move the wp-content is for security if you move this to an unexpected location any hackers looking to target this area won't be able to find it, or it will make it more difficult to find.

To change the location of the wp-content is quite simple as the location of this folder can be configured in your wp-config.php file.

All you have to do is add a new variable WP_CONTENT_DIR and change the location of your wp-content folder.

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content' );

To change the location of the wp-content URL there is another variable you can define in the wp-config.

define( 'WP_CONTENT_URL', 'http://www.paulund.co.uk/blog/content/wp-content' );

Continue reading »

Handle Keyboard Shortcuts With Mousetrap.js

Mousetrap

Mousetrap.js is a javascript plugin that makes it easy to setup keyboard shortcuts for your web applications.

It allows you to define functions to run on certain key pushes, you can set it on a single key or a combination of keys together or a sequence of keys.

Mousetrap.js is available on github and you can download it here.

Download Mousetrap.js

Browser Support

Mousetrap.js can be used in any browser, it has support built in to be used on:

  • Internet Explorer 6+
  • Chrome
  • Safari
  • Firefox
  • Opera

How To Use

Just like any other Javascript file all you have to do is include it on the page and a new mousetrap object will be created for you.

<script src="./js/mousetrap.js"></script>

Continue reading »