Tag: PHP
-

Universal Processing of WordPress Blocks: ACF & Native (React)
Modern WordPress development empowers you to build custom blocks using either Advanced Custom Fields (ACF) or native React. For maintainable, scalable projects, it’s crucial to adopt a universal approach to structuring, building, and registering your blocks—regardless of their type. This article provides a unified workflow for processing both ACF and native (React) blocks, covering file…
-

PHPStan and PHP CS Fixer guide
Maintaining code quality is crucial. In this post, I’ll show you how to set up two essential PHP development tools: PHPStan for static analysis and PHP CS Fixer for automated code styling. Prerequisites Before we begin, make sure you have Composer installed on your system. Composer is a dependency manager for PHP that we’ll use…
-

Simplify WordPress
Managing a WordPress site can sometimes feel overwhelming with all the extra features and functionalities that might not be necessary for everyone. The “Headache” snippet is a collection of code functions designed to remove or disable various WordPress elements that might be considered redundant or unnecessary for the average user. Below, we’ll go through each…
-

WordPress – Enhance Gutenberg blocks with custom attributes using HTML API
Tailoring the Gutenberg editor’s blocks to meet your website’s specific needs is now more straightforward with WordPress’s HTML API. The following PHP code snippet demonstrates how to add custom classes and attributes to the content of native Gutenberg paragraph, list, and image blocks. The Code How It Enhances Your Blocks Benefits for Your WordPress Site…
-

WordPress – Add page specific body classes
In web design, CSS plays a crucial role in customizing the look and feel of individual pages. To give you more power over styling, the following PHP snippet allows you to dynamically add the page slug as a class to the <body> tag of each page on your WordPress site. The Code How It Functions…
-

WordPress – Remove auto p in excerpt
WordPress automatically applies paragraph formatting to excerpts using the <p> tag, which can sometimes disrupt the desired layout or styling of your website. If you’re looking to have more control over how your excerpts are displayed, the following PHP code snippet allows you to remove WordPress’s default automatic paragraph tagging and gives you the option…
-

WordPress – Boost GraphQL query limits
When working with GraphQL in WordPress, you might encounter limitations on the number of queries you can execute. By default, GraphQL imposes a cap to ensure performance and server health. However, there are scenarios where you need to increase this limit to accommodate larger data sets or complex queries. The following snippet of code allows…
-

WordPress – Handle theme.json RGB color transparency
WordPress’s theme.json has brought unparalleled ease to theme customization. However, the default color settings, which are typically in hexadecimal format, lack support for transparency. To enhance your theme’s color capabilities, we’ve developed a solution that introduces RGB color values with transparency. Find out how to do it with HSL here. The Code Our custom PHP…
-

WordPress – Handle theme.json HSL color transparency
WordPress’s full site editing capabilities have revolutionized theme customization, allowing for an extensive range of configurations through the theme.json file. However, one limitation has been the inability to handle color transparency effectively with traditional hexadecimal color codes. To address this, we’ve crafted a solution to enhance your theme’s color system. Find out how to do…
-

WordPress – How to remove default theme colors
Crafting a unique look and feel for your WordPress site often involves overriding the default color palettes, gradients, and typography sizes that come with the core or themes. The following PHP code snippet is designed to help you start with a clean slate by removing these defaults. The Code This snippet should be added to…
