Barry Hughes WordPress Developer

Hello there, thanks for visiting!

I’m a software developer based on beautiful Vancouver Island with a particular interest in web-based open source software like WordPress. I’ve helped to build, test, manage and support a diverse range of online projects and, when the mood takes me, I share thoughts, tools, links and whatever else might take my fancy right here on my blog.

No SSL, thanks

9 July 2019 (updated 9 July 2019)

I love my HTTPS as much as the next person, but for local dev purposes it can be handy to disable this in the context of working on a WooCommerce project.

To that end…adding the following bits of code can be helpful.

add_action( 'init', function() {
	remove_action( 'template_redirect', [ 'WC_HTTPS', 'force_https_template_redirect' ] );
} );

The above should be added to a (mu-)plugin, accompanied by the following in the site’s (wp-)config.php file:

define( 'FORCE_SSL', false );
define( 'FORCE_SSL_ADMIN', false );
define( 'FORCE_SSL_LOGIN', false );

Of course, this is for ease of local development only.

Am I in Sandbox Mode? (Braintree|WooCommerce)

10 April 2019 (updated 11 April 2019)

Setting up a test environment to use a Braintree sandbox account is pretty straightforward and is well documented.

However, once done there are no visual flags within the Settings → Payments → Braintree screen to indicate that one is indeed in “sandbox mode” (or the reverse, that one is in production mode). Occasionally, though, there can be a need to quickly confirm that this is the case and, when that happens, there are a couple of easy things you can do:

Determining the Ubuntu codename in Linux Mint

5 March 2018

Often, when setting up repositories on Ubuntu and related distros, you will need to know the release codename. In general, you can grab this using:

lsb_release -cs

This is great, except the codename you receive if you use this under Linux Mint (let’s say “sylvia”) may not match the codename you would receive if you used the same command under a stock Ubuntu install (let’s say “xenial”) and oftentimes it’s the upstream codename (“xenial” in my example) that you will need.

The information is readily available with some search engine-foo, but it can also be found locally within /etc/upstream-release/lsb-release. I wanted a handy one liner for the future, so I added the following line to my .bash_aliases files:

alias upstream-lsb="grep DISTRIB_CODENAME /etc/upstream-release/lsb-release | grep -o --colour=never \"[a-z-]*$\""

With that in place (don’t forget to reload it, ie source ~/.bash_aliases or equivalent!) things are a piece of cake. Example of usage:

$ upstream-lsb

Overriding MySQL settings

17 January 2018

Every now and again it’s time to setup a new machine and I wrestle with getting MySQL to observe my custom bind_address and other settings. Which settings file should I override and in which order are they consumed by the MySQL server, anyway?

mysql --help

The output from the above command contains the answer. Aside from some typical help file stuff about various options and switches, it also shows the value of various server variables and contains a section like this example, from which you can learn the order in which MySQL loads .cnf files:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf 
The following groups are read: mysql client

Now I know the order of precedence, as well as the groups that are actually read in.

WordPress, Nginx and 404 pages for .php files

15 January 2018

Nginx all setup and correct? Check! WordPress installed and ready to go? Check! 404 Not Found pages all working as expected? Almost 😐.

If you’re finding that attempts to access bring you to a nicely crafted, theme-generated and possibly witty 404 Not Found page but (note that *.php file extension) takes you to a rather starker looking Nginx-generated 404 page, then you have a few options that include just living with it.

Assuming for consistency’s sake however that the only option you really want to shoot for is to have non-existent *.php files take you a WordPress 404 page then what you’re probably looking for is the error_page directive.

Options, options, options

10 January 2018 (updated 10 January 2018)

Though Firefox has made a strong comeback over the last few months with its Quantum engine and other initiatives, I remain really stoked by Vivaldi and the sheer potential it offers for a personalized browsing experience through a rich array of options and settings.

Screenshot showing multi-tab selection/actions in Vivaldi

A huge amount is configurable, yet it manages to remain a browser that requires very little or no setup work from new users.

Of course, some amount of what Vivaldi offers is achievable with the usual mainstream browsers via various extensions — but it’s also true that a lot of it’s features are not available even with extensions (or at least, due to limits of what extensions can do, cannot be done anything like as tidily).

What really appeals to me, though, given my browser is very much a part of my daily working environment, is just how neatly Vivaldi bundles this stuff up and gives me control: it offers a clean, customizable space I can make my own … and at a high level, a lot of the principles that attract me to Vivaldi seem like things I can take and imbue my own software projects with and I’m going to make it a personal challenge to do just that.

Lifetime licensing in the WordPress ecosystem

11 December 2017

With no particular facts and figures to hand to back this up, I’m going to suggest that most commercial WordPress plugins and themes now employ one of the following funding models:

These are not mutually exclusive and there is an amount of mixing and matching that commonly happens. There are also other strategems, such as a lifetime licensing model — pay once and receive access to support and updates for the entire lifetime of the product.

Bolting new views on to The Events Calendar

6 December 2017 (updated 6 December 2017)

The Events Calendar is a useful calendaring plugin for WordPress providing a number of default views (list, month and day views) through which visitors can browse published events.

Sometimes those default views are all you need — they are well crafted and look great out of the box in most cases. Other times, in order to make those calendar views really mesh with the active theme (or with other facets of a project), some stylistic changes may need to be made via custom CSS or by altering the HTML output.

That’s great and the process for doing so is pretty well documented, but an alternative approach I wanted to explore was to take an existing view and use it as the foundation for an entirely new view with a look and feel all of its own. In other words, instead of customizing list view (for example) I wanted to leave it as it is and simply use it as the foundation for a new view that would run side-by-side with it and act in a very similar way, but look quite different .

Vivaldi: sync settings

29 November 2017

Vivaldi is one of my favourite browsers … in fact, it is my favourite browser.

Though it’s based on some well established technologies the project itself is newer and has had less time to mature than, say, Firefox or Opera – so there are a few rough edges. What it offers though is the potential for near-unbounded customization of the browsing experience and the minor wrinkles that exist are not enough to stop me from being excited and engaged by everything else it offers.

One thing I – and I think a considerable number of users – have been waiting on is support for secure sync (of passwords, bookmarks, etc) and so it was really exciting to hear that progress has been made and sync has landed in a snapshot.