25% off ProSNIPC25OFF

Snippet library

WordPress code snippets, ready to use.

707 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.

JavaScript

Smooth Anchor Scrolling with Header Offset

Intercepts hash-link clicks and scrolls to the target element with a configurable offset for fixed headers.

#anchor#javascript#navigation
JavaScript

Back-to-Top Button

Injects a fixed back-to-top button that appears after scrolling 400px and scrolls to the top on click.

#button#javascript#navigation
CSSPro

Dark Mode via prefers-color-scheme

Applies a full dark-mode palette through CSS custom properties when the OS dark-mode preference is active.

#accessibility#css#dark-mode
CSSPro

Skeleton Loading Shimmer Animation

Provides animated shimmer placeholder blocks (text lines, avatar, card) to show while content is loading.

#animation#css#loading
CSS

Smooth Scroll with Header Offset

Enables CSS smooth scrolling globally and adds a scroll-margin-top to anchor targets so they clear a fixed header.

#anchor#css#navigation
CSS

Custom Text Selection Color

Overrides the browser default text-selection highlight with brand colours, with a separate scheme for code blocks.

#branding#css#selection
CSS

Visible Focus Outline (Accessibility)

Hides the focus ring for mouse/touch users while preserving a clear, high-contrast outline for keyboard navigation.

#a11y#accessibility#css
CSS

Responsive 16:9 Video Wrapper

Wraps iframes and video embeds in a fluid container that maintains a 16:9 aspect ratio at any viewport width.

#css#embed#iframe
CSS

Print Stylesheet

Hides navigation and sidebars, forces black text, and expands link URLs for a clean print layout.

#accessibility#css#media-query
CSSPro

Custom Scrollbar Styling

Replaces the browser default scrollbar with a slim, themed scrollbar using WebKit and Firefox APIs.

#css#scrollbar#styling
CSS

Sticky Footer Layout

Forces the page footer to stay at the bottom of the viewport on short-content pages using flexbox.

#css#flexbox#footer
PHPPro

Add Page Template Name as Body Class

Appends a tpl-{slug} CSS class to the body tag derived from the active page template filename, enabling per-template styling in the front-end stylesheet.

#css#customization#frontend
PHPPro

Restrict Block Editor to an Allowed Block List

Limits the block inserter on the "post" post type to a curated set of core blocks, preventing editors from using layout or advanced blocks that may break the design.

#blocks#editor#gutenberg
PHPPro

Disable Block Editor for Specific Post Types

Disables the Gutenberg block editor for the "landing_page" and "staff_profile" post types, falling back to the Classic Editor for those content types.

#classic-editor#editor#gutenberg
PHPPro

Log Failed Login Attempts to a Transient

Records each failed login with the attempted username, IP address, and timestamp into a daily transient, keeping the last 100 entries for admin review.

#logging#login#security
PHPPro

Email Admin on New User Registration

Sends the admin a plain-text email with the new user's login, email address, and a direct link to their profile whenever someone registers.

#email#notifications#registration
PHPPro

WP-Cron Job to Republish Stuck Scheduled Posts

Schedules an hourly cron event that finds future-dated posts whose publish time has passed and publishes them, fixing missed scheduled posts.

#automation#cron#posts
PHPPro

Scheduled Weekly Cleanup of Expired Transients

Registers a weekly WP-Cron event that deletes all expired non-autoload transients from the options table to reclaim database space.

#cleanup#cron#performance
PHPPro

REST Endpoint: Admin Site Statistics

Registers a GET /wp-json/scseed/v1/site-stats endpoint (admin-only) that returns published post counts per public post type, total users, and software versions.

#admin#monitoring#rest-api
PHPPro

Disable REST API Access for Non-Logged-In Users

Returns a 401 Unauthorized error for all REST API requests made by unauthenticated visitors, protecting data from public exposure.

#access#authentication#rest-api
PHPPro

Add Reading Time Field to Posts REST Response

Registers a reading_time_minutes field on the post REST object that returns the estimated read time based on a 200 words-per-minute reading speed.

#custom-fields#json#posts
PHPPro

REST Endpoint: Recent Posts by Type

Registers a GET /wp-json/scseed/v1/recent-posts endpoint that returns the most recent published posts for any public post type, with count and type query params.

#endpoint#json#posts
PHPPro

Allow SVG Uploads with DOM Sanitization

Enables SVG file uploads and automatically sanitizes each uploaded SVG by stripping script elements, event-handler attributes, and javascript: href values via DOMDocument.

#media#sanitization#security
PHP

Register a Custom Block Category

Inserts a "My Custom Blocks" category at the top of the block inserter panel for grouping site-specific custom blocks.

#blocks#customization#editor