Kategorier
WordPress

Prevent WordPress plugin from being disabled

You properly already know that you can create a “MU” plugin, that prevents your plugin from being disabled. But what if your theme depends on a plugin, you installed from WordPress.org, that you do not want your users to disable? Add this to your functions.php: $plugin = ‘akismet/akismet.php’; // you might want to change this […]

Kategorier
Yii Framework

Different fontend views based on user role, with Yii2 Framework

Or what I like to call “frontend environments”. Before reading on, please note that this method depends on using the Yii2 authManager with Role Based Access Control (RBAC) and the yii2-app-advanced template. “Environments” are located inside:frontend/environments/{role_name}/ This path contains the controllers and views directories, etc. First step is to “configure” the environments. The array key […]

Kategorier
WordPress

Simple lightbox gallery for WordPress (with blocks) in 2 minutes

If you are looking for a nice and simple lightbox implementation, you should really give simplebox.js a try. The actual result: Neat, right? No plugin, minimal maintenance (and overhead) – it just works, what else can you ask for? How it’s done First download the simplebox.js files and upload them to your child theme (you are […]

Kategorier
WordPress

Lazy load CSS in WordPress

When using Google PageSpeed Insights you might be presented for opportunities to speed up your application. Most likely, amongst those opportunities there will be a suggestion to: Eliminate render-blocking resources A solution to this is to lazy (or asynchronous) load your Style Sheets (CSS). This can be achieved by this piece of code in your themes functions.php […]

Kategorier
NGINX

Rate limit NGINX by User-Agent

Bots can be intelligent, but also aggressive, and sometimes they become really annoying and affect the performance of your system.