I’ve moved my hosting back to SiteGround

This week I moved both my websites (this one and SEC digital calendar and lectionary) back to SiteGround.

Just over 48 hours ago I updated the DNS settings and initiated the switch to the new server. Other than a slightly misconfigured Cloudflare CDN everything has gone smoothly. This is in part due to my experience of having done this a couple of times now, and in part due to the excellent and clear controls that SiteGround offers behind the scenes.

Continue reading I’ve moved my hosting back to SiteGround

Writing to the Google Chrome console from PHP

Chrome Logger is a Google Chrome extension for debugging server side applications in the Chrome console.
Chrome Logger is a Google Chrome extension for debugging server side applications in the Chrome console.

This afternoon I finally got round to figuring out why my workaround for changing the Divi projects custom post type to anything you want had broken in Divi 2.5.

In the end it was deceptively simple. I’d set the priority values for the add_action($hook, $function_to_add, $priority) and remove_action($hook, $function_to_add, $priority) functions too low.

WordPress uses the priority value to determine in which order particular actions are run. The default value is 10. The higher the value, the later it will be executed.

While I was investigating this, it crossed my mind that it would be really useful if I could write values to the Google Chrome console in the same way that you can when writing and debugging JavaScript.

It turns out you can, using Chrome Logger plus the ChromePhp library.

With the Chrome Logger extension installed and enabled on the tab I wanted to write to, all I had to do was include the library and log some data. Like this:

<?php
    include 'ChromePhp.php';
    ChromePhp::log('Hello console!');
    ChromePhp::log($_SERVER);
    ChromePhp::warn('something went wrong!');
?>

Very useful. And as well as a library for PHP there are also libraries for

  • ColdFusion
  • Go
  • Java
  • .NET
  • Node.js
  • Perl
  • Python
  • Ruby

You can find details on the Chrome Logger website.

 

New website for Pittenweem Properties

Pittenweem Properties: self-catering in the East Neuk of Fife
Pittenweem Properties: self-catering in the East Neuk of Fife

Over the last few months in the evenings and at weekends, I’ve been working on redesigning the Pittenweem Properties website for friends here in Anstruther. The site launched a couple of weeks ago.

Pittenweem Properties offers high-quality self-catered holiday accommodation and property management services in and around Pittenweem. They currently manage properties in Carnbee just outside Anstruther and Pittenweem. But their portfolio is growing and for good reason — the properties they own and manage are to a very high standard and in a beautiful part of Scotland: the East Neuk of Fife.

WP Booking System

The site was quite fun to build.

We used Trello for communication and project planning, WordPress (of course!) as the content management system, and the Divi theme from Elegant Themes which allowed me to very quickly design and build the site. I also changed the built-in projects custom-post-type to properties using the method I blogged about in March: changing the Divi projects custom post type to anything you want.

For the booking calendar we turned to a premium theme: WP Booking System which we found intuitive and offered most of the features we needed:

  • Multiple booking calendars.
  • Submit booking requests via form.
  • Display anywhere (on page or within widgets) using a shortcode.
  • Customisable display features, including splitable legend for check-in and check-out).

If this plugin had also allowed online payments, say via PayPal, then it would have been absolutely perfect but as it is we’ve been really happy with the functionality and usability of this plugin.

There is a free version of the plugin, but it offers only one calendar and has customisation limitations. The premium version costs only US $34 (approx. GBP £21.50).

Next…

While the site is now live there are still a few bits and pieces to do, such as keep an eye on analytics data and try to improve search engine rankings.

Websites are never really finished, are they?

It was a fun project to work on. Time to focus on optimising family finances and admin, and cracking on with writing my book.

Review of CodeLobster PHP Edition 5.5 (Professional version)

About CodeLobster

In April of last year (2014) I received an email from someone from CodeLobster asking if I would be interested in reviewing their code editor.

They kindly, and promptly, sent me a registration code to unlock the full version, but I then went off sick, and then ran into relationship problems, and then I got even sicker, and finally a year later here’s my review.

Disclaimer: I don’t work for or with CodeLobster, I’m not being paid for this review (other than having been kindly gifted a full registration) and views expressed here are my own.

I did, however, used to use CodeLobster (the free version) as my back-up code editor when my primary editor was WeBuilder. I liked how fast it was, but I never really explored its capabilities.

These days I use Sublime Text 3, so it will be interesting to see how this editor compares: could I conceivably use CodeLobster as a replacement?

As I’m currently working mostly with WordPress, that’s what I’ll focus on in this review.

Three versions, multiple features

CodeLobster PHP Edition (which, incidentally, appears to be their only edition) comes in three versions: free, lite and professional.

The free version contains all the basic features that you might expect from a modern IDE: syntax highlighting for HTML, CSS, JavaScript and PHP, code autocomplete, code folding, pair highlighting and selection, project manager, etc.

The lite version adds to this code validation for HTML, CSS, Sass, Less and PHP; a SQL manager; and support for version control systems such as SVN, Git, etc.

Finally, the professional version (which I have installed here) builds on this by adding support for a variety of popular content management systems (Drupal, Joomla! and WordPress) and both JavaScript and PHP code frameworks (CakePHP, CodeIgniter, Facebook, jQuery, Laravel, Symfony, etc.)

View a comparison of the three versions.

Cost

What I like about the professional version is how modular it is, as it is simply the lite version (US $39.95, approx. GBP £26.80) with additional plugins (US $24.95–$49.95 each).

For example, if you only ever develop for WordPress then you can simply add the WordPress plugin (US $39.95): total price US $79.90 (approx. GBP £53.60).

If you plan to use more than one plugin then it seems to be generally more cost-effective to buy the complete bundle for a total of US $119.95 (approx. GBP £80.48), which is a saving of 70% compared with buying each plugin individually, which would come to US $379.45 (approx. GBP £254.60).

Installation

Installation was pretty simple. All three versions are bundled with the same installer; the various features are unlocked with an appropriate serial number.

I do like that the Help > Registration… dialog shows you exactly which plugins you have enabled, and in the case of trial versions how many days you have left.

CodeLobster registration window showing the status of each plugin.
CodeLobster registration window showing the status of each plugin.

User interface

In contrast to the minimalist interfaces of Sublime Text, Atom and Brackets, CodeLobster employs a more traditional multi-panel layout.

CodeLobster interfacing, using the Sublime Text Monokai theme
CodeLobster interfacing, using the Sublime Text Monokai theme

Each of the panels is tabbed, supporting multiple functions: file, class view, project, SQL, TODO, search results, bookmarks, errors, help, properties, map, etc. They are also collapsible, creating more space for the code editor.

Along the top of the application are optional toolbars, where you can also switch on or off the panel tabs. Unfortunately, the toolbars don’t appear to be customizable.

Having been using Sublime Text for the last few years the interface feels very busy, and really quite dated.

Text editor

Unlike some code editors that I’ve used, CodeLobster’s autocomplete and code hinting capabilities are very quick, and rather quite helpful.

Code hints
Code hints for the get_template_part WordPress function.

Hovering over a WordPress function, a speech bubble appears showing brief, but useful, documentation about it. It’s fast and it’s unobtrusive.

Code autocomplete
Code autocomplete

Having selected View > Autocomplete for… WordPress, autocomplete options pop-up very quickly whenever you start typing something that looks like a WordPress function or keyword.

The autocomplete helper is context-sensitive, though. So if you are working in a JavaScript file, or create a <script> tag in your document, then the autocomplete will switch to JavaScript and jQuery (assuming you have that module enabled, of course).

On the right, double-clicking a function in the help panel opens the corresponding documentation in the WordPress Codex.

Documentation finder

Creating local WordPress projects

Create a new WordPress project
Create a new WordPress project

One of the really nice features I like about CodeLobster is its ability to quickly set up a new WordPress project on your local server. This assumes you’re running a local dev environment such as XAMPP.

After filling in a few details (including database connection details) CodeLobster goes off to the local environment and sets everything up for you:

  • Download and unpack the latest version of WordPress to your local dev environment.
  • Create a new MySQL database.
  • Install WordPress.
  • Populate the basic settings (site title, admin)

I’ve tried this in previous versions of CodeLobster and each time I simply couldn’t get it to work properly. I’m not sure what I was doing wrong, but this time, in this version: it worked!

I tried it both with a database that I’d already created in phpMyAdmin, and without. It worked successfully each time. This is a really useful feature for quickly starting WordPress projects: it gets you up and running in no time.

Niggles

So far, so good. But I have a few little niggles.

The interface does look quite outdated: the newest visual style it offers is based on VisualStudio 2005. It’s not a deal-breaker, but something a little more modern would be very welcome.

You cannot drag and drop files into the editor, you have to go through the File > Open dialog. I have two monitors. I often drag and drop files into Sublime Text. It’s a much quicker method than going through a dialog box.

To create new files, you cannot simply double-click the document bar, like you can with some editors. You have to go through the File > New dialog. It does mean that quickly creating temporary throw-away documents isn’t a particularly fast task.

Something that I do find frustrating is that I can’t quickly move the CodeLobster window from monitor to monitor. I use a utility called WinSplit Revolution that allows me to assign shortcut keys to move applications from one monitor to another, or even to reposition it on the screen. But it doesn’t work with CodeLobster. It’s the only application that I have installed that it doesn’t work with.

Conclusion

I have only just scratched the surface here, but it’s clear to me that CodeLobster is a powerful and capable IDE. It has a lot of built-in tools for generating, testing and debugging code, that certainly appear fast.

My biggest issue, though, as I’ve indicated is the user-interface. It now feels very outdated, which may put some developers off. But if you can work beyond that, there are some really powerful features inside.

That you can quickly create a development installation of WordPress on your localhost server is brilliant. And I’m so glad whatever issues there were previously have now been fixed.

To be honest, CodeLobster doesn’t currently offer enough to draw me away from Sublime Text 3; I love the speed and flexibility of ST3. But I have to say that if I was working on a PHP-heavy site, or a major new WordPress site then I seriously might consider using CodeLobster, for its code intelligence capabilities.

I have a project like that coming up soon. I’ll be sure to report back…

Download CodeLobster for free.

Using Akismet on WordPress Multisite

Akismet is a WordPress plugin for dealing with comment spam. It’s pretty good and simple to set up:

  1. Sign up for an Akismet plan (from free for a personal site, to $50 per month for enterprise).
  2. Use the API key generated to activate your plugin.

The API key (like a license key) is in the format abcde1f23456.

And that’s fine if you have only one site, but if you’re running WordPress multisite then you don’t want to have to activate Akismet individually for each sub-site. That’s just tedious.

Wouldn’t it be much better if you could just add the API key once?

Akismet doesn’t offer that option within the user interface on Multisite. Undeterred, I went in search of a way to do it.

How to do it

The wonderful folks over at WPMU DEV have a really useful blog post from July 2013 about how to do this: How to use Akismet on WordPress Multisite with 1 license key.

The good news it’s really simple:

  1. Open wp-config.php in your favourite text editor.
  2. The WPMU DEV article recommends that you add the API code  below the comment /* That's all, stop editing! Happy blogging. */ but I prefer to add it below the define() block for Multisite. But you can add it where you like, really.
  3. Add the following code define('WPCOM_API_KEY','abcde1f23456');
  4. Save wp-config.php and upload it to your site.

Your wp-config.php file will then look something like this:

[php]
/** Multisite */
define(‘WP_ALLOW_MULTISITE’, true );
define(‘MULTISITE’, true);
define(‘SUBDOMAIN_INSTALL’, false);
define(‘DOMAIN_CURRENT_SITE’, ‘www.example.com’);
define(‘PATH_CURRENT_SITE’, ‘/’);
define(‘SITE_ID_CURRENT_SITE’, 1);
define(‘BLOG_ID_CURRENT_SITE’, 1);

/** Define WordPress.com API key for Akismet in WordPress Multisite */
define(‘WPCOM_API_KEY’,’abcde1f23456′);
[/php]

Like many things on this blog I’ve added this here primarily for my own reference, but I hope it helps you too.

The real credit on how to do this, of course, goes to Sarah Gooding from WPMU DEV: thank you.

Happy spam-free blogging!