Minifying and concatenating your scripts and stylesheets in WordPress with MinQueue

Last week I was at Smashing Conference in Oxford manning the stand with a few fellow Automatticians. I was asked a couple of times about why WordPress doesn’t automatically minify and concatenate scripts and stylesheets – the array of scripts and stylesheets that WordPress loads can be severely inflated by various plugins and themes and the hit to performance is not insignificant.

I can think of quite a few reasons why this isn’t handled automatically, but it did get me thinking that it wouldn’t be too difficult to build a plugin that does just that.

So I started sketching it out, before realising to my simultaneous delight and slight disappointment that someone has already done it. However I’m quite surprised that the plugin isn’t more broadly used and more known about – MinQueue only has 21 stars on GitHub and c. 3,300 downloads from the repository.

Screen Shot 2014-03-28 at 12.51.34

Anyway, I’ve been playing around with it and it’s excellent – nicely packaged and very easy to set up (and dig into if you’re interested in how it works.)

I think the vast majority of self-hosted WordPress sites would benefit from having it activated, especially given how easily you can set it up.

How to create a really simple custom WordPress login page and sign up page without plugins

There are many different ways of customising the WordPress login page and process. However, many of these methods are over-engineered or are so stylised or complicated that they are difficult to shoehorn into the project that you might be working on.

I’m writing this post in an effort to be super-simple, and provide the most basic of tools needed to create a custom WordPress login page and sign up page.

The key WordPress functions that this tutorial is centred on are:

1. wp_signon – Authenticates a user with option to remember credentials.

2. wp_create_user – This function allows you to insert a new user into the WordPress database.

Note: This tutorial contains no information on styling your login page. I’m presuming you already have a style or design in mind.

Step 1 – Create a new template page called login.php

Very basically, this is what you need to process your form:

And very basically, this is all your login form needs to be:

Once you’ve created the template, create a new page that uses the “Login” template and for the purposes of this tutorial, name it “Login”. You can call it whatever your like, but note that this tutorial has hard-coded references to the page’s URL being:

So you need to make sure that your page’s permalink matches this, or change the URLs in the code to match whatever URL your new “Login” page has.

Step 2 – Done – if you visit your new login page, it should successfully log you in. Now, let’s tidy things up a bit.

So, it’s likely that you’re going to want to redirect anyone trying to use the standard WordPress login pages to your new, custom login page. Easy peasy, shove this in your theme’s functions.php file:

 Step 3 – Now, we do something very similar for the sign up page – create register.php

This code also contains some very basic validation, that creates an array of the errors. You can use these however you like, or just get rid of them for testing purposes.

Further down the register.php template, your sign up form should look something like this:

Then, in WordPress, you create your page called “Register” and you choose this template for it. And once again, we add some redirects to our functions.php file to completely hide the standard WordPress register page:

Again, our register script is assuming that the register page is found at:

You now have login and sign up pages ready to be customised in whichever way you want.

Step 4 – Take a step back, and observe the wonder that you have created

No more bogstandard WordPress login and register pages for your website. This implementation can be further developed with custom logout links and a proper method for dealing with forgotten passwords. I’ll get some guidance on how you do that up on here soon.