The proper way to load stylesheets or scripts in WordPress is to enqueue them in functions.php. The process is explained very well in the WordPress Developer Area. However, recently Google changed the format it uses for multiple font face or weight font downloads. This is causing only the first font family to be downloaded. To […]
Category: WordPress
Useful WordPress Snippets
Automatically Wrap Feature Images In The Permalink Some themes, such as TwentyTwenty, don’t wrap feature images in the permalink. However, since this is such a standard web idiom, you might want to consider implementing it in your own themes or child theme. The following code will accomplish that task, as long as you are not […]
WordPress Escape Methods
It is often said that the first rule in data security is to trust no one. From the WordPress developer handbook: It’s best to do the output validation as late as possible, ideally as it’s being outputted, as opposed to further up in your script. This way you can always be sure that your data […]
WordPress Basics Lab Exercise
Some of these “review” tasks we might not have done in class yet, or they might not all have been covered by the videos I’ve assigned. If that’s the case, think of those parts of the task as “review while figuring out” exercises. First, download these images. You will use these images in a couple […]
Enqueuing for Scripts Enqueueing scripts (or local stylesheets), it is a bit more complicated, but it’s learnable. Underneath the last wp_enqueue_style function, type wp_enqueue and select wp_enqueue_script from the menu that shows up (thank you, WordPress Snippets extension). The following helpful boilerplate is output, showing us what arguments are expected by the function: The values […]
For this exercise, please download and install this Duplicator archive package into a new empty database. Installed with this package is a plugin called Show Current Template. That will add information on the ADMIN bar when you’re logged in and viewing pages in the browser, showing what template files are involved in the creation of the […]
In this exercise, you will download and configure a free WordPress theme, and some plugins. You are welcome to use the Internet or your notes. Install the Project Site First please download this duplicator package [updated Jan 2022]. Also, please download the screenshots package. Now, install this downloaded site into your MAMP testing environment. If […]
Below are some of the Visual Studio Code Extensions I use and recommend: Live Server: automatically reloads browser when html or css files are saved Rainbow Brackets: colors bracket pairs. Very useful in JavaScript StyleLint: error checking for CSS File Utils: adds file management functionality (duplicate, rename, move, etc) VSCode-Random: generated random data. CSS Navigation: for searching […]
The main focus of this exercise will be the use of JavaScript in WordPress. Setup First, please download the starter package. When you unzip the file, you will find a Duplicator installer and archive. Make a new database and install the site into your testing environment (most likely MAMP). Make a new SASS-based theme called […]
If you need to output the title of an archive in a WordPress theme, you could use functions like single_cat_title(), single_tag_title(), etc. The trouble, however, is that they’re limited to the type of archive (category, tag, etc) listed in the function name itself. A more versatile approach is to use the_archive_title function. It will work on any […]