In some cases, it can be very helpful to use the WordPress installation URL for a PHP validation procedure. The following example shows how easily you can get the installation URL of WordPress by using a small PHP function. How do I get the correct URL of the WordPress installation? Th ...
Martin Jost
Minify or compress CSS in PHP
For developers of plugins or themes, it is important to provide the included CSS (stylesheets) files to the user in a compressed or minified version. This mainly benefits the page speed of the website and is very helpful for the search engine optimization as well as for the user experi ...
Minify and compress Javascript files in PHP
Loading time is an important factor in search engine optimization and for the user experience. Especially for theme developers, it’s important to compress or minimize all embedded javascript files for live use on a web page. How can I compress Javascript files? The following PHP ...
Convert HEX color to RGBA color code in PHP
While working with theme or plugin options, in some cases we need to convert a hex (hexadecimal) color code, which we get from a color picker field to the corresponding RGBA color code, e.g. to get a RGBA color value with the transparency for using in CSS. How to convert hex to RGB or ...
Calculate the correct content width for the Gutenberg editor
The WordPress Gutenberg editor allows you to customize and edit web page content according to the frontend design. Gutenberg will share the frontend design experience of the website into the editor. A good starting point is to get the correct content width from the frontend view inside ...
Add custom classes to the WordPress BODY tag
Anyone who develops their own theme with a customizable layout or settings a theme needs to add custom CSS class names to the BODY tag of the WordPress website. Custom class names inside the BODY tag of the website give us great opportunities to easily customize a theme according to th ...
Set custom WordPress post format for custom post type
If you’re working with custom post types in WordPress, you may have noticed that all post formats for the default post type automatically apply to custom post types as well. Depending on the type of post, this does not always make sense to use the post formats such as “imag ...
Remove date / time from WordPress comments
By default, the date and time of a comment are displayed in WordPress. Basically, it is always a theme decision how comments are displayed. Sometimes less is more and the commenting time should be removed in the design point of view. How can I hide the date? We use the WordPress filter ...