Template Include Callback Function

This snippet shows how to provide a callback for a template_include where we check the current context of the page (if it’s a single post with type = “doc”), and then if the conditions match we provide a template from the plugin.

Example Block Init with register_block_type()

This snippet was auto-generated by using the Create Block NPM package available from WordPress by running the CLI command: It utilizes register_block_type() and defines the build directory as the single argument. WP expects this directory to have a block.json file, which is also created automatically by the Create Block NPM package.

Turn on WordPress Debug Logging

These lines belong in wp-config.php. Usually by default you’ll have a single line that has WP_DEBUG defined as false or 0. It’s important to find that line and edit it to avoid having your debug lines overwritten.

Template Include in Plugin

In a WordPress plugin we can use template_include filter to provide a default template that will be used under various conditions. The most common condition would be to provide a single post template for a custom post type that the plugin registers. Another common condition is to provide an archive template for a taxonomy or […]

Tailwind CLI watch command

Use the npx tailwindcss command to watch changes in the -i input file and generate the -o output file.

WordPress Archive Template Loop

Only the loop part for an archive template. Standardized approach, uses only default available functions and core post type data. Extend it to add custom fields in an archive targeting a single post type.

Enqueue Script

How to enqueue a script in WordPress. Use in theme functions.php or adapt to utilize in a WordPress plugin.