wordpress

Configuring a WordFence Firewall for multiple AddOn Domains on GoDaddy

For any plan over Economy, GoDaddy offers the ability to host multiple sites within a single directory (also known as “AddOn Domains”). The primary site lives at the root of the hosting directory (public_html/); all non-primary sites live within subdirectories in this same directory (e.g. public_html/addon_domain1/). Only a single php.ini file, located in the hosting […]

Freeing a site stuck in maintenance mode

HELP — IT’S HAPPENED TO ME. TELL ME WHAT TO DO! The WordPress “update” function is one of its strongest features, downloading and swapping in updated Themes, Plugins, even components of WordPress itself, all with a single click. When it works, that is. In order to perform this update, the function temporarily puts the site […]

How to prevent WordPress from overwriting your rewrite rules

Provided the permissions are properly set on the .htaccess file, WordPress will update it with its own rewrite rules whenever the “Save Changes” button on Settings > Permalinks is clicked, like so: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] […]

Hardcoding a default theme

To preset a custom theme as the default for a WordPress project, copy it into wp-content/themes/, then add this line to the wp-config.php file, replacing ‘theme-name’ with the name of the new default: define(‘WP_DEFAULT_THEME’, ‘theme-name’);

REM to Pixels calculator

Few are the occasions when I’ve needed to convert pixels to REM, usually only when I’m working with a child theme based on one of the default WordPress themes (like Twenty Sixteen). Even fewer are the occasions when I’ve needed to reverse the sausage crank and convert REM back to pixels. And yet, it was […]

Installing WordPress in its own subdirectory

There are occasions when I prefer to house WordPress in its own subdirectory, such as when I’m using it as the core CMS but building auxiliary functionality alongside it with something like CakePHP. Note: If you’re planning on using version control with your project, I’ve outlined a slightly different method for installing WordPress in a […]

Pixels to REM calculator

The default WordPress theme Twenty Sixteen is clean, simple, and responsive; as such it makes a perfect “starter” theme for all but the most arcane designs. However, it uses REM — a.k.a. relative em units — for the all the measurements and sizing in its stylesheet and, unfortunately, unless one is a genius, REMs have […]

Image Path in CSS File

Image paths are relative to the CSS file that contains them. If, for example, you had your images and css files each in their own subdirectories within the theme (i.e. “img/” and “css/”, respectively), here’s the path one would use: .navigation { background-image: url(../img/navigation.png); }

Disabling Comments on Posts and Pages

By default commenting is enabled on both Posts and Pages in WordPress. Here’s how to disable it: Existing Posts Click Posts in the left navigation. Click the checkbox in the section header (to the left of Title) to select all pages. Select Edit from the Bulk Actions dropdown and click the Apply button. Select Do […]

Get the Category ID by the Category Name

Here’s a handy function that takes the category name and returns the category id: function get_category_id($name) {     $term = get_term_by(‘name’, $name, ‘category’);     return $term->term_id; } Save this function to functions.php and call it like any other function. In this example we use it to return a list of all posts in a category […]