Skip to content
  • Home
  • Send Test Email
  • Snippets

Welcome To Snippets.Cloud - The Biggest Code Snippets Library For WordPress

Snippets.cloud
  • Home
  • Send Test Email
  • Snippets
Snippets.cloud
All (10)PHP (10)
  • PHP

One-Click “Set as Featured Image” Button for Any Image Block (Classic & Custom Themes)

Why it’s new and useful:WordPress 6.8 introduced the ability to set any image block as the featured image directly from the editor interface, streamlining workflows for content creators. However, in classic themes or custom workflows, this feature may not be as…

ViewOne-Click “Set as Featured Image” Button for Any Image Block (Classic & Custom Themes)
  • PHP

Dynamic Post Count Shortcode for Categories, Tags, or Any Taxonomy

Why it’s new and useful:WordPress 6.8 introduced the Query Total block for block themes, but there’s no built-in way to display post counts for specific categories or taxonomies in classic themes, widgets, or anywhere shortcodes are accepted. This snippet fills…

ViewDynamic Post Count Shortcode for Categories, Tags, or Any Taxonomy
  • PHP

Accessible Accordion FAQ Using the Enhanced Details Block

Why it’s new and useful:WordPress 6.8 introduced the ability to group multiple Details blocks using the name attribute, which creates a true accordion effect—opening one section closes the others automatically. This snippet lets you quickly create an accessible FAQ accordion in the Block…

ViewAccessible Accordion FAQ Using the Enhanced Details Block
  • PHP

Public REST API Access for WordPress Menus

Why it’s new and useful:Starting with WordPress 6.8, menus are not publicly accessible via the REST API by default for privacy and security. However, many headless WordPress sites, mobile apps, or custom front-ends need to fetch menu data. This snippet…

ViewPublic REST API Access for WordPress Menus
  • PHP

Smart Speculative Loading for WordPress 6.8+

Why it’s new and useful:WordPress 6.8 introduced support for the Speculation Rules API, which enables browsers to preload and even prerender pages the user is likely to visit next. This snippet auto-injects a smart speculation rules script, excluding sensitive URLs like the…

ViewSmart Speculative Loading for WordPress 6.8+
  • PHP

Smart Table of Contents (TOC) Shortcode with Scroll Tracking

Why it’s new and useful:Table of Contents plugins are everywhere, but most are heavy or lack dynamic features. This snippet introduces a [smart_toc] shortcode that auto-generates a Table of Contents from your post’s headings (H2/H3), highlights the current section as you scroll,…

ViewSmart Table of Contents (TOC) Shortcode with Scroll Tracking
  • PHP

Instant Copy-to-Clipboard Shortcode for Code Blocks

Why it’s new and useful:Developers, bloggers, and educators often share code snippets. Adding a “Copy” button next to code blocks improves UX, but most solutions require plugins or heavy JavaScript. This lightweight snippet introduces a [copy_code] shortcode that wraps your code and…

ViewInstant Copy-to-Clipboard Shortcode for Code Blocks
  • PHP

WordPress Cryptocurrency Dashboard Widget

A custom WordPress dashboard widget displaying the top 10 cryptocurrencies with icons, real-time prices, and 24-hour percentage changes using the free Coinpaprika API. This widget provides at-a-glance crypto market information directly in your WordPress admin dashboard with automatic updates and…

ViewWordPress Cryptocurrency Dashboard Widget
  • PHP

Crypto Donation

ViewCrypto Donation
  • PHP

Convert Uploaded Images to WebP Format

The snippet hooks into WordPress’s image upload process and converts uploaded images to the WebP format. Add this snippet to your theme’s functions.php file, or add it as a new

ViewConvert Uploaded Images to WebP Format

Trending now

Convert Uploaded Images to WebP Format
WordPress Cryptocurrency Dashboard Widget
Instant Copy-to-Clipboard Shortcode for Code Blocks
Smart Table of Contents (TOC) Shortcode with Scroll Tracking
Copyright © 2025 - WordPress Theme by CreativeThemes