WordPress theme’s can have a multitude of options requiring manual configuration to tailor the theme to your liking. This post looks at using WP-CLI to configure theme options from the macOS command line. To demonstrate, I’ll use the option that controls the posts appearing in the slider at the top of this site’s home page.
Temporarily Disabling the WordPress Google Authenticator Plugin from the Command Line
This WordPress site uses the Google Authenticator plugin to provide two-factor authentication (2FA) when logging-in to the administration area. Occasionally I need to temporarily disable 2FA in order to publish posts from the blogging software I use. Traditionally toggling 2FA is achieved from the WordPress backend. This post looks at two alternative methods of doing this locally from the command line.
Using the Cloudflare API to Manage DNS Records
I’m probably doing Cloudflare a disservice by categorising it as a CDN provider, but that’s certainly one of the many services they offer and perhaps how most individuals using their free offering see them. Like me, I’m certain the vast majority of that group use the Cloudflare dashboard to configure their domains, but Cloudflare provides an API that allows you to programmatically manage those DNS records through a command-line interface of a *nix shell such as Bash.
Changing How WordPress Displays Comments
Comments in WordPress are displayed using the wp_list_comments() function. This function takes many arguments. One of these is callback which takes the name of a defined function that in turn determines what and how comment data is output. If no callback function is given, wp_list_comments() uses a built-in default function.
mysqli::prepare Fails Using ALTER TABLE in a Statement With Parameter Markers
Part of a project I’m working on requires re-setting a MySQL table by deleting most – but not all – rows. In PHP I’m using mysqli::prepare to prepare the MySQL statements.
$id = 5; $query = $conn->prepare("DELETE FROM table WHERE id>?");
The MySQL statement includes a parameter marker – denoted by ? – which is then substituted for the value of the $id variable using mysqli::bind_param.
Collapsible Sidebar Lists Plugin for WordPress
A previous theme I used for this site incorporated For some while this site’s been using the collapsible sidebar lists I described in this post. This method requires manually adding PHP and Javascript to the theme’s code. All a bit clunky really.
I’ve finally completed a plugin which provides the same functionality, but in a far more convenient way. The collapsible lists currently displayed in this site’s sidebar are generated by this plugin.
Global Variables in PHP vs JavaScript
I’m still relatively new to PHP and the one thing that continues to trip me up is the use of global variables. I cut my programming teeth many years ago on languages like C and Visual Basic and more recently JavaScript, all of which handle global variables differently to PHP.
Vertical, Horizontal & Diagonal Spry Sliding Panels
I was recently looking to give my photo gallery an overhaul. I’m quite a fan of Adobe’s Spry framework, so I thought I’d give the Sliding Panels widget a try. There are several examples on Adobe’s site showing panels sliding vertically, horizontally and in any direction. The direction is controlled by some CSS and after successfully playing around with vertical and horizontal sliding I couldn’t figure out from the examples how to get the panels to slide in any direction. That is until I realised how the panels are laid out and the importance of one particular CSS declaration.
Recent Comments