
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.

Add an Export CSV button to any post type list screen. It checks the nonce and capability, exports terms and meta, and blocks spreadsheet formula injection.

Register a Block Bindings source that fills core Paragraph, Heading and Button blocks with a post’s last-updated date and author.

By the default categories and tags are enabled to Posts only. To enable in Page you can use this code snippet. You can add it on your Functions.php or use any code snippet plugin that supports php blocks such as Scripts Organizer.

Files structure The project is organized with a very simple file structure. At the root, there is a build.js file which is the script that runs esbuild and compiles both the JavaScript and SCSS into production-ready code. The dist folder is where the compiled files end up — inside you’ll find main.min.js for the bundled…

github yaml location This will push code to NPM after you craete tag with v Example: v1.0.1 NPM_AUTH_TOKEN esbuild.js package.json example

Instead of adding one by one you can include all files inside /inc/ folder If you need to load only php files

CSS Needs minimum selector Load CSS in Editor Load CSS in Theme (Front End)

By the default WordPress used 90% image compression on JPEG images. That can give small blurred effect. To keep them clear use 100% of image quality

YOURSERVER = Example (ftp.markokrstic.com) Navigate to the settings > Secrets Add your secrets Get more actions examples https://github.com/marketplace/actions/sftp-deploy

Code Snippet If you are unsure what website port your website is using you can use this code snippet to see it in the website footer.

Code Snippet Creating a custom webpack configuration file for @WordPress/Scripts Create “webpack.config.js” in the plugn root

As I never menaged to set up WordPress/Scripts –hot I prefer to use Browser Sync Install NPM After instaling NPX Create block run: Then in the package.json update scripts section Replace ‘dev-wordpress.local’ with your local websute URL

With this workflow in place, creating a new release is as simple as pushing a version tag to your repository. The GitHub Action takes care of everything else for you. It checks out your code, sets up Node.js (using the latest LTS version), and installs your project’s dependencies if a package.json file is present. Once…

Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following: Checkout/create orphan branch (this branch won’t show in git branch command): Add all the files to…

Place this in function.php or use Scripts Organizer Code Snippet. We’ll let WordPress think it’s a block theme so the Editor shows up, but we’ll override template loading to use PHP templates like index.php. In your functions.php, override the block template resolution like this: This forces WordPress to always use index.php for rendering the front-end…

To disable the default block patterns in WordPress (so only your custom patterns are available), use the following method in your custom blank theme: Add this to the functions.php or you can use code snippet editors.
3rd party plugins actions admin archive attachment block-themes Blocks build Category config Content CPT CSS Custom Post custom post types Developer development Front End githubpages gutenberg hook Image img livereload load styles Must Have notice npm Oxygen pages php port redirect release repeater security settings page single product Taxonomy themes Tips webpack WooCommerce wordpress WP Admin