Change locale in WordPress SEO to EN_GB

A client this morning emailed me to ask how to change the locale of her website from the default en_US language to the UK version while running the Yoast WordPress SEO plugin. While some people think that by installing WordPress as the UK version does this, it doesn’t. This only really alters the language file … Continued

Adding a Contact Form 7 form into a PHP template in WordPress

Sometimes you may want to add a contact form 7 form into a template directly. While normal use is via a shortcode eg, you can’t use this directly inside a PHP page template. Instead, you need to wrap this inside the WordPress do_shortcode function, in order to enable it to parse correctly. Wrapping your form … Continued

Add Category ID into the body and post class in WordPress

Here’s a little snippet I regularly use to add the ID of the post/page into the body class and post class. It’s really helpful to aid targeting specific things in CSS, add functionality with javascript and to quickly pinpoint the ID of a page without checking through the back-end. Add this to your themes functions.php … Continued

Call Google’s jQuery Library in Your Template

Why use your own bandwidth when you can use Google’s own! This snippet ensures your WordPress website correctly calls the Google jQuery library direct from Google for speed, security and reliability: NB: Just make sure you use the above with… …in your header file, or wherever your wp_head scripts get called from.

Remove the admin bar from the front-end of WordPress

This little snippet removes the admin bar permanently from all users while logged in and viewing the website from the front-end. Personally, I never use it and always turn it off with this little snippet.

Remove Error Message on WP-login to increase security

Hackers and bots are more prevalent than ever. It is vitally important you protect your WordPress install from every type of potential attack. One simple way hackers attempt to get into your install is via the login form. Most people stick with ‘admin’ as the default username for their admin account. This is bad. Already, … Continued

Add additional class to WordPress sub-menu item

I needed to target a particular parent menu and add an additional class to the sub-menu ul element. As WordPress builds the menu, you won’t find it in any theme files. Also, I didn’t want to add this globally as the site I was working on was responsive and I shared the same class on … Continued