Categories
Block Editor Gutenberg WordPress

How to extend blocks in the Gutenberg editor on WordPress

Important: This post assumes that you already know how to work with JavaScript ES6 and have some experience in working with and setting up custom blocks on WordPress using Webpack. Gutenberg Blocks With the introduction of WordPress 5, we now have a new powerful tool at our disposal: Blocks. Blocks let us build custom experiences […]

Categories
WordPress

WordPress + Cloudinary = Dynamic, optimized, on-the-fly images!

Bringing Cloudinary to WordPress People have tried to bring Cloudinary to WordPress, and have really complicated the whole thing. The official Cloudinary plugin, in my opinion, is really clunky and in the way in most cases. Other solutions follow the same route, and are just too complicated. Since I wasn’t able to find a good […]

Categories
WordPress

How to add a custom WP CLI command in WordPress

What is WP CLI? WP-CLI is the official command-line interface for WordPress. It helps developers automate tasks, and increase their productivity. It opens up a whole array of opportunities once you’ve started using it. It comes with a whole bunch of useful commands like cache clearing, cron, media management, user management, and many other useful […]

Categories
WordPress

WordPress Admin: How to Fix the “Fatal Error: Allowed Memory Size…” Error

The Problem If you’ve been working on a complex WordPress site with a lot of custom fields, perhaps with the Advanced Custom Fields (ACF) plugin – chances are you’ve come across this error when you try to access your post type in the WordPress admin: “Fatal error: Allowed memory size of xxx bytes exhausted (tried […]

Categories
Web Development WordPress

WordPress: How to create image sizes dynamically on the fly

WordPress is awesome. But like any system, it’s not great at everything. One of those things is media image size management, where it just doesn’t work well. The Problems: WordPress uses something called “Thumbnail Image Sizes” to maintain different versions of your images in different image sizes. You define these image sizes under Settings -> […]

Categories
Web Development WordPress

WordPress dynamically change user capabilities

I was looking for an easy way to dynamically add or remove capabilities for users based on either their IDs or roles, but I couldn’t find any elegant solution. That is until I found a beautiful filter: https://codex.wordpress.org/Plugin_API/Filter_Reference/user_has_cap It’s so simple, and you can just add this to your functions.php file, or use it in […]

Categories
WordPress

Make Polylang WordPress plugin copy the content from the original post

If you’re like me, you love Polylang! I’ve used WPML in the past, and Polylang makes it look like an oversized overpowering slowpoke. What I hate the most about WPML is the fact that it is not “fully compatible” with Advanced Custom Fields, which is stupid to put it politely. There is one problem with […]

Categories
Web Development WordPress

How to get the second level navigation only from WordPress wp_nav_menu()

We’ve all been there. There’s a perfectly good menu in the admin under Appearance -> Menus which has the whole site laid out perfectly. Now we start coding the templates and realize that we only need sub-menu items of a particular page, of a particular level from that menu. There are two ways to do […]

Categories
Magento Web Development

How to add a color picker in the Magento admin or anywhere

Greetings, developers of all colors! First of all this tutorial assumes that you already know how to make a Magento extension. Now there are many ways to add a color picker in the Magento admin (or anywhere). Here’s one “correct” and “extendable” way to do it: First, we would need a color picker. This color […]

Categories
Magento Web Development

Magento direct SQL queries with named binding

If you’ve been coding in Magento long enough, you would have come across a situation where you need to query the database directly. For whatever reason, no judgements. Well, here is my contribution to save you a lot of time. And this is as secure as using models to interact with your database. If you […]