Code Snippet: Display latest Post per Category

A while ago a client wanted to display the latest post per category on the WordPress blog page. The goal was to respect sticky posts and therefore exclude the category used by the latest sticky post. WordPress offers the pre_get_posts action hook to alter the WP_Query instance before it runs the query on the database. …

Read moreCode Snippet: Display latest Post per Category

Redirect all requests to https with .htaccess

Redirect all traffic to https using htaccess. Secure your users with the snippet provided here. All you need is an SSL cert and a few lines in your htaccess file. 1. Make sure you have a valid SSL certificate 🔐 All modern hosting companies offer free Let’s encrypt certificates. If you aren’t sure, check with …

Read moreRedirect all requests to https with .htaccess

Code Snippet: WordPress Page Template Redirect to child page

Sometimes you need a simple way to redirect a parent page directly to it’s first child page in WordPress. This little snippet is a WordPress page template to be used in your theme. It includes support for WPML, in case you still use my least favorite translation plugin in the universe. I strongly suggest you …

Read moreCode Snippet: WordPress Page Template Redirect to child page