
Copy-paste snippets for blocks, block themes, security, performance, Tailwind CSS, PHP and React. New snippets every Monday, Wednesday and Friday, each one run in a real WordPress before it is published.

Print Google Tag Manager or any other script right after the opening body tag in WordPress with the wp_body_open hook, no theme edits.

Shrink the WordPress header logo when the visitor scrolls, with a small plain JavaScript class toggle and a CSS transition. No jQuery.

I put this code-snippet to every Oxygen site i develop, because it is faster to go to the settings by admin bar,I use Scripts Organizer to use this as below : Add a code-block with Trigger location set to EVERYWHERE put the code and you are done.

Change or remove the WordPress password protected message, add a link to request the password, and keep it working on translated sites.

Stop WordPress from creating the medium_large, 1536×1536 and 2048×2048 image sizes for every upload, and keep the sizes you use.

Sometimes when you are in a development environment like Laravel Valet on your home computer, you may have errors show up. you can use the following code to hide them Edit wp-config.php file and add the following anywhere ini_set(‘display_errors’,’Off’); ini_set(‘error_reporting’, E_ALL ); define(‘WP_DEBUG’, false); define(‘WP_DEBUG_DISPLAY’, false);

Use the following code to add extra required classes during Oxywind worker compiling / cache generation when you are ready for production. You may want to do this if you want to use tailwind classes in your HTML code outside of oxygen elsewhere in wordpress or a 3rd party / custom plugin. This will save…

Setup daisyUI CDN Ready For Development Add the following code to use the full daisyUI CDN while developing, this includes all daisyUI elements. These will be later purged by the Oxywind worker so only the elements you use will be included in your production site. Add daisyUI To Oxywind Worker Configuration In the Oxywind settings…

This is taken form Facebook conversation in the Official Oxygen Builder group. Follow up on the conversation.

Hide WooCommerce products with a price of 0 or no price from the shop, categories, search and product shortcodes, with one small snippet.

if you do not use it. Keep add elements sidebar clean. Solution to hide If you are using Scripts Organizer download code snippet Solution to Disabled Thanks to Suppa Mike for providing second solution.

A WordPress shortcode that shows the terms of any taxonomy as links, limited to a number you choose, with escaped output and no PHP warnings.

Use JavaScript to hide element for one year. It’s perfect for banners such as cookie. You can easily change parameters and change it from 365 days to what ever you need. Your element need to have class of “element-dismiss” and you need to place button element inside

This will allow you to create a button that uses the history states to go back with pure HTML. You will then have to style it to make it look as required. It is useful if you end up on checkout pages or forms that have no headers or footers and wish to give the…

This allows you to hide that ruler on the bottom of the builder that often gets in the way of doing mobile responsive work. Set as CSS custom code

Put an Add Media upload link on the WordPress admin bar, in wp-admin and on the front end, for users who can upload files.

This is a snippet for Oxy Ultimate Woo plugin that allows you to change the default “No product in cart” to anything you like. Credit to the Developer, you can see the original code here

Fo those using Oxy Ultimate Woo Cart component, this is a snippet to change the text on the checkout button to anything you need. This is courtesy of the developer and work perfectly, see original here
3rd party plugins actions admin archive block-themes block editor Blocks block styles block theme build Category core CPT CSS custom post types debugging development full site editing gutenberg hook hooks Image javascript load styles Must Have npm Oxygen performance php plugins repeater rest api scripts organizer security settings api single product tailwind Taxonomy theme.json Tips updates WooCommerce wordpress wp-cli WP Admin