WordPress Filters Example for Beginners

WordPress comes with a lot of built in amazingness, one of those are filters. You can filter a lot of different things that WordPress outputs into your theme or from your plugin that originate from another place.

That means you can add or remove something to all titles, category names or widgets. That might not seem incredibly useful at first, but if you for example want to add a text at the end of a blog post or page while using an already existing theme, it can be very nifty.

Continue reading “WordPress Filters Example for Beginners”

How to Create a Custom Landing Page in WordPress

If you’re using a WordPress theme you’re actually quite happy with, but you just want to change the appearance of individual pages completely, you can make use of two great things in WordPress. The possibility to create child themes and custom page templates.

For jonathanmh.com I wanted a great first page load time that enables users to quickly see what the page is about and not just show my latest blog posts. At the time of writing I’m using the twentyfifteen WordPress theme, but I wanted the front page to be separate from that entirely.

Continue reading “How to Create a Custom Landing Page in WordPress”

WordPress: Which Plugin Loads Script? (Contact Form 7, jQuery)

Recently I was benchmarking a site and wondering why jQuery (no offense) was loaded on every page when I was very sure I did not include it in the custom written theme for that site.

As it turns out Contact Form 7 requires jQuery. On every load.

When you know that you only provide a contact form on one page of your entire website, it might be overkill to load jQuery on every page, even though it’s not a requirement for any of the other JavaScript code on your website.

Conditionally Loading JavaScript Code with WordPress

Continue reading “WordPress: Which Plugin Loads Script? (Contact Form 7, jQuery)”

Using Preact with WordPress Themes, Plugins and more

Preact is a faster and smaller alternative to React and I have come to like it for building interactive components into WordPress themes and plugins. In this post we’ll go through how to write a Preact Component and how to inject it into an existing WordPress theme.

On my blog, at the time of writing, I’m using the twentysixteen theme with a few minor changes, one of those is the related posts that show up at the bottom of each blog post, which is a tiny plugin exposing an API and rendering through Preact.

If you’re used to React, you’ll feel right at home with Preact straight away.

This is what my related posts plugin looks like at the moment:

Continue reading “Using Preact with WordPress Themes, Plugins and more”

WordPress .htaccess and Permalink Cheat Sheet

WordPress is still incredibly popular and sometimes you have a to move a WordPress installation or you want to change your permalink structure. Regardless of your motivation, you probably don’t want to hurt your SEO.

I’ve spent some time writing and testing .htaccess for Apache2 redirects recently, so I thought I’d share a list of commonly needed WordPress redirects using regular expressions or just removing segments.

By default I’ll assume you use a .htaccess file that looks something like this:

Continue reading “WordPress .htaccess and Permalink Cheat Sheet”

A Comical Guide to Webpack, Vue.js 2, Gulp and WordPress [Tutorial]

Building WordPress themes and plugins is a big market and it gets a lot of people into web development, so I named this post like I did, but it really works for most CMS, no matter if you want to write a theme for WordPress, Drupal, GHOST, Magento or what ever else is out there. I’m going to show a simple webpack config that helps you transpile your JavaScript and develop your themes as usual.

TLDR; Here’s how to do stuff and me rambling in between. Use one of these links to get to your preferred headline:

Continue reading “A Comical Guide to Webpack, Vue.js 2, Gulp and WordPress [Tutorial]”

NGINX / Apache: Block Requests to PHP file (xmlrpc.php)

This is going to be a short post about how to block your webserver from serving a specific file.

WordPress comes with a file called xmlrpc.php which enables you to use their mobile App on self-hosted blogs or enables ping- and trackbacks. However, there is a bunch of bots out there that attempt to brute-force their way in and can produce either high load or actually present a security risk.

Continue reading “NGINX / Apache: Block Requests to PHP file (xmlrpc.php)”

Featured Image in RSS Feed WordPress Plugin

Continue reading “Featured Image in RSS Feed WordPress Plugin”

On Winning Your Days

We live in a very competitive and challenging society, which is why I quickly wanted to share a feeling I had today, which I want to turn into a habit. For a lot of my life my drive has come from just being dissatisfied with myself.

Today I feel a little more that I actually achieved something and I don’t focus on all the things I have not yet done. I have not yet gotten back to all of my clients, I have not yet done as much for my day job as I wanted to, but I still got things done. Continue reading “On Winning Your Days”

CigTrack Day #3: Open Source Software

Linux and other open source software play a significant role in technology nowadays. Linux runs on most supercomputers, server systems and most smartphones (inside Android) in the world.

I also use Linux on the desktop and especially for development it’s just great. You can test in an environment that is very close to your server and there’s many great tools that are made for developers. Also Linux makes it easy to write your own tools. Continue reading “CigTrack Day #3: Open Source Software”