wordpress
get_template_part in WordPress with variables
As some of you might know, the get_template_part() -function of WordPress doesn’t allow you to pass variables. This can be quite annoying sometimes when you want to include a template several times, but each time with different parameters. Imagine a situation for example where you want to show 3 category blocks next to each other, that read further ...WordPress: Templates in plugins
When you are creating a WordPress plugin, you might encounter the situation where you have to include a template in your theme. But you also want to give the users of your plugin the ability to make changes to this template, without overwriting the core template. The most intuitive way to provide this is by read further ...Prevent WordPress spam with a nonce and Akismet
You might struggle something when preventing spam on your WordPress blog. Sure, the built-in post-types of WordPress might already have some spam-protection (like nonces and/or Akismet), but what if you are creating your own post-types? Or you have some exotic submission-form that is not using any post-type at all? Well, in those cases you can fairly read further ...How to create a ‘Rate this post’-plugin for WordPress
I’ve been pondering with the idea of a specific WordPress plugin for a while now, and I had the idea that when I am going to create it, I am also going to write it down in a simple tutorial for you guys to read. So let’s get started shall we?read further ...Create post thumbnails in WordPress with wp_get_image_editor()
So the other day I had to implement a thumbnail of the featured image in WordPress. Little did I know about a little feature in WordPress called wp_get_image_editor, which is basically a tool that allows you to edit an image (resize and crop it), and save it as a new image.read further ...3 different ways to setup your WordPress theme
When it comes to customizing your WordPress installation, there are various ways to get the same thing done. I already wrote an article a while ago, describing how you can keep your WordPress template clean. In this article I’ll explain how a specific task in WordPress can be done in different ways. Each method has read further ...Add a checkbox to the media library in WordPress
So recently I had the situation where I needed to add a checkbox to the images in my media library in WordPress. The main purpose of it was to mark an image to be visible in the image gallery. On the frontend I would filter the images according to this flag. In this article I’ll read further ...How to keep your WordPress theme clean
More than once when I look at WordPress themes I see a lot of disorganised code. This varies from functions.php -files with hundreds lines of code that are a mixture user-specified functions and WordPress-specific functions (add_filter() , add_action() , etc). Also the templates files themselves are more often a complete mixture of HTML and massive blocks of PHP-code. Even read further ...