How to add code to the header in WordPress

WordPress has a hook that lets us add arbitrary HTML code to the <header> tag of a website. Several plugins can be found that accomplish this, but it’s so easy to do that a plugin is often overkill. Here’s how you can execute an arbitrary PHP function using the wp_head hook: // write some text … Read more

How to show a list of all articles in WordPress

There’s a handy function in WordPress called wp_get_archives(). With it we can create a lot of useful output with just a few lines of code. To list all articles ever published on a site, we can do this: // list all articles on this site // https://codex.wordpress.org/Template_Tags/wp_get_archives $args = array( 'type' => 'postbypost', 'limit' => … Read more

How to fix the “Occasional White Screen of Death” Error in WordPress

In this video I’ll show you how to fix an odd phenomenon I’d like to call “The Occasional White Screen of Death”. Here’s what happened:

Read more