Free to use

Code snippets

Small, ready-to-use pieces of PHP, JavaScript, and WooCommerce code from real client projects — copy them straight from the page, or grab the full file on GitHub.

WordPress

Register and Output a Custom Nav Menu

Adds a new menu location you can assign in Appearance → Menus, shows how to output it in a template, and includes the multi-menu version too.

View snippet
WordPress

Define a Reusable Global String

A simple pattern for storing a value — like a phone number or address — in one place and reusing it anywhere in your theme.

View snippet
WordPress

Auto-Escape HTML Typed Inside Code Tags

Makes sure any markup typed inside <code> or <tt> tags in the editor gets escaped automatically, so it displays as visible text instead of being rendered as real HTML.

View snippet
WordPress

Register and Output a Custom Image Size

Defines a new named thumbnail size, plus two different ways to pull that image back out in a template.

View snippet
WordPress

Build a Simple Custom Settings Page

Adds a new page under Appearance with the WordPress Settings API wired up — a starting point for a theme options panel with your own fields.

View snippet
WordPress

Turn Off Post Revisions Entirely

Stops WordPress from saving a new revision every time you update a post or page.

View snippet
WordPress

Register a Basic Custom Post Type

A minimal starting template for registering your own custom post type, with title/editor/excerpt/thumbnail support and archive pages enabled.

View snippet
WordPress

Show a Thumbnail Column in the Post List Table

Adds a small featured-image preview column to the posts list in wp-admin, so you don't have to open each post to see its thumbnail.

View snippet
WordPress

Fully Disable Comments Site-Wide

Removes comment support from posts and pages, and hides the Comments menu from both the admin sidebar and the admin bar.

View snippet
WordPress

Enable Tags for Media Attachments

Same idea as attachment categories, but for tags — lets you tag individual media library items.

View snippet
WordPress

Cap the Number of Saved Revisions Per Post

Instead of disabling revisions entirely, this keeps only a set number of the most recent ones.

View snippet
WordPress

Add a “Lead” Class to a Post’s Opening Paragraph

Wraps the first paragraph of post content in a lead class, handy for styling an intro paragraph larger or bolder than the rest.

View snippet