WordPress Archives

Tips and Tricks on WordPress usage and development. I am very passionate about WordPress, but it doesn’t work just by itself – it needs a rich environment to live and breathe in.

If you’re after theme and plugin alterations, we have a category for that.

WordPress 5.0 and Gutenberg: What does this mean for you

In this episode I’m explaining the implications of the new default text editor in WordPress 5.0. It’s called Gutenberg, named after the man who invented the printing press (and hence revolutionised how printed books were duplicated and distributed at the time). I’ll also show you how to test drive the Gutenberg editor in WordPress 4.9 … Read more

How to share ebooks with WordPress (EPUB and MOBI files)

If you’ve ever tried to upload an ebook in .MOBI or .EPUB format with the WordPress Media Uploader, you will have noticed an error message appear. Something along the lines of “Sorry, this file type is not permitted for security reasons”.

The only way then appears to be to ZIP the file and share it. That’s not a great experience for mobile users, who would simply like to click on a file and open it in an application such as iBooks or Kindle.

The solution to this puzzle lies in adding the required mime types to WordPress, so that these file types are allowed.

Let me show you how to do it in this article.

Read more

How to display categories in Automattic’s P2 Theme

By default, Automattic’s phenomenal P2 theme does not support posting into categories from the front page, it only supports tags. My fork of the theme called P2 Categories does that though and lets you conveniently select a category from a drop down menu right there on the front page.

I wrote an update to it last week, and in so doing my article from 2013 came in handy that explains how to add this functionality to P2. Nothing much has changed in the source code, so it’s still relevant and accurate.

What the above article did not explain however was how to show which category a post belongs to. And because it’s still fresh in my  memory how to do this, I thought I’d better write it down for next time (and anyone who’s interested in how to do it).

Read more

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: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. … Read more