Force a file to download when link is clicked

So here’s a simple snippet for when you want to force a download of a file (such as a PDF, .doc etc), when a link is clicked. The default action will open the document in the either the same browser window, or in a new tab/window by using the usual target methods: Open file in … Continued

Make Div Full Height Of Device Display Size

Previously, I wrote a short post with a snippet to allow full-size CSS backgrounds. This is great and I use it all the time, but this method will stretch the image background to the max width, thus height is in proportion to the width. What this means, is that landscape images will perfectly fit the … Continued

Remove Related Videos From WordPress oEmbed Youtube Videos

If you’re embedding videos into WordPress, possibly as a post, you may sometimes want to add parameters to the code to overwrite the oEmbed default behaviour of WordPress. This can be achieved by creating your own plugin or adding this snippet to your functions.php file. This example removes the related videos at the end of … Continued

Increase Upload Limit in OpenCart 1.5.x

It’s rather annoying having to tweak the compression of images to get under OpenCarts 300kb limit on images and files. When using PNG files for slides, I’d rather increase the limit than decrease the quality of product images to get them into OpenCart, especially as you cannot simply upload direct into the images folder (due … Continued

Redirect users to another URL by IP using PHP

Here’s a handy snippet I’ve used a few times now. I find it handy for quick redirects should you want to send all other users to another page such as a maintenance page, coming soon page or other holding page. It allows all users NOT using the IP listed to be sent elsewhere, allowing those … Continued

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

Add new admin user in OpenCart from PHPMyAdmin

A new client project I’m working on requires I duplicate their website, install it on my development server and work on it before transferring it back onto their server once complete. To do this, I need access to the OpenCart admin panel, but I want to keep the existing admin users where they are and … Continued

Magento: Fixing Cannot add or update a child row: a foreign key constraint fails

I’m currently completing a rather large project for a client. While I regularly make backups before installing any major extensions or conducting core work, yesterday I needed to make my first restore on this particular database. While Magento has a great tool for backups and restores, I always prefer to do it manually from either … 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