One design pattern that I get passed off to me fairly frequently is a headline with a centered line filling the space to the right or on both sides. Here is an example: I’ve found a few different ways to accomplish this effect in the past. They worked but always felt a little hacky and… Continue reading Using Flexbox and Pseudo Elements for Text Between Lines
Programmatically Adding a Menu Item to a WordPress Menu
Just today I had to add a logo to a WordPress menu on a site I was working on. Because it is a graphic that I needed to add, I couldn’t easily use the default WordPress menu functionality to accomplish this. One possible workaround, I think, could have been to add a class to the… Continue reading Programmatically Adding a Menu Item to a WordPress Menu
Hiding empty paragraphs
For the most part, I have really warmed up to the Gutenberg editor in WordPress. It took me a while. I was very used to the “old ways,” but the flexibility and promise of Gutenberg have won me over. One small thing that I have noticed, though, is that it is really common for users… Continue reading Hiding empty paragraphs
Importing a MySQL Dump with Bad Dates
A problem that I run into fairly regularly when transferring older sites to my local environment is that, when importing the MySQL dump, I get an error like: ERROR 1292 – Incorrect date value: ‘0000-00-00’ It seems that, prior to version 5.7, MySQL used to allow invalid dates like 0000-00-00. However, this behavior changed in… Continue reading Importing a MySQL Dump with Bad Dates
Adding the Page Order to the Page List in the WordPress Admin
I like to keep my WordPress sites’ admin areas as organized and clean as possible to limit confusion and to make items easy to find. One example of this is trying to keep my WordPress Pages in a logical order. When I look at the Pages list in the WordPress admin I like it to… Continue reading Adding the Page Order to the Page List in the WordPress Admin
A Fallback for Ray
As I mentioned in a previous article, I really like using Ray for debugging as I develop WordPress projects. However, one thing that can be easy to do is to forget to remove all of your calls to ray() and upload to a production site where the Ray plugin is not installed. Then… ack! An… Continue reading A Fallback for Ray
Using an SVG Icon for a WordPress Custom Post Type
When creating a Custom Post Type in WordPress there is a convenient way to select a custom icon when registering the post type. WordPress comes with a set of built-in icons called Dashicons that have easy names that can be used for your menu_icon property: Having these icons at hand is great. Unfortunately, I often… Continue reading Using an SVG Icon for a WordPress Custom Post Type
It’s (Not) a Shame About Ray
Allow me to admit a failing of mine. I always seem to have a problem getting Xdebug to work reliably. I actually felt like I had a pretty good handle on it using MAMP and PHPStorm. It mostly “just worked.” But after I added too many sites into MAMP, MAMP itself began to become unresponsive… Continue reading It’s (Not) a Shame About Ray
Creating a Rewrite Rule in WordPress
Recently I had to create an endpoint for users to view a dynamically-generated PDF on a site. I wanted to have a nice-looking URL for users. I found it difficult to wrap my head around the process of adding a rewrite rule in WordPress but I finally figured it out. WordPress offers a function, add_rewrite_rule,… Continue reading Creating a Rewrite Rule in WordPress
Passing PHP Variables to JavaScript in WordPress
One thing that I found difficult to understand when starting out with WordPress development was how to use PHP variables in my JavaScript. I’m not sure why I found it so confusing. There are a lot of good examples out there but I thought I would break down how use PHP variables in your JavaScript… Continue reading Passing PHP Variables to JavaScript in WordPress