跳到内容

Custom Class Add On Page

v1.0.0

syedkamruzzaman · 2025年10月9日 上架

Add safely-prefixed custom classes to Pages, Posts, CPTs, and WooCommerce views—no theme edits required.

正在使用
10 以下
评分
暂无
累计下载
478
最近更新
2025年10月10日
需要 WordPress 6.7+已测试到 6.8.13PHP 7.2+

截图

Settings screen—add a class and choose where it applies
Settings screen—add a class and choose where it applies
Page/Post/CPT selectors (conditional dropdowns)
Page/Post/CPT selectors (conditional dropdowns)
Rules table with locations and delete action
Rules table with locations and delete action
Example: class added to <body> on the front end
Example: class added to <body> on the front end
WooCommerce Shop page with custom body class
WooCommerce Shop page with custom body class

Add your own CSS classes to specific Pages, Posts, or Custom Post Types—without editing theme files.
Add custom <body> classes—safely prefixed—on any Page, Post, CPT, or WooCommerce view (Shop, Cart, Checkout, My Account) with zero theme edits.

I created Custom Class Add On Page as a simple way to manage <body> classes with a safe ccaop_ prefix. Choose the target (Page, Blog page, Single Post, CPT archive/single, or a specific CPT item), save, and the class is injected via the body_class filter. Clean code, lightweight implementation, and solving real problems are the focus. Collaboration and feedback are welcome.

Highlights
– Add classes to: a single Page, the Blog (Posts) page, all Single Posts, CPT Archive, all CPT Singles, or a specific CPT item.
– Safe auto-prefix (ccaop_) prevents conflicts.
– WooCommerce-aware: Shop (product archive), Cart, Checkout, and My Account are supported.
– Clean admin UI with a table listing every rule you’ve created (class + location) and a delete action.
– Activation redirect: after activation, you’re taken straight to the settings page.
– Lightweight: uses the body_class filter only—no front-end bloat.

Video Tutorial

⚡ What you can configure

  • Enter a custom class name (auto-saved as ccaop_{your_class}).
  • Choose where to apply it: Page / Post / Custom Post.
  • For Page pick any page (Blog/Posts page is intentionally excluded here; use Post Blog page).
  • For Post choose Blog page (posts index) or All single posts.
  • For Custom Post choose the CPT and target (Archive, All single, or Specific item).

Usage

  1. Go to Dashboard Class Option.
  2. Type your class name (e.g. hero, saves as ccaop_hero).
  3. Select Page / Post / Custom Post, then pick the exact target.
  4. Click Save. Visit the selected view and inspect <body>—you’ll see your class.

⚡ Features

  • Ready to use—no coding needed
  • Auto-prefixed classes to avoid collisions
  • Page / Post / CPT (archive, single, specific item) targets
  • WooCommerce Shop, Cart, Checkout, My Account support
  • Rule list with delete action
  • Lightweight & fast, theme-agnostic
  • Works with cached sites (no dynamic output buffering)

WooCommerce Notes

If you select the Shop page under Page, the plugin detects it as the product archive and adds your class on Shop views correctly.
Similarly, Cart, Checkout (including endpoints like order-pay, order-received) and My Account are handled.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums