secondsky/claude-skills / plugins/wordpress-plugin-core/skills/wordpress-plugin-core
wordpress-plugin-core
FlaggedWordPress plugin development with hooks, security, REST API, custom post types. Use for plugin creation, $wpdb queries, Settings API, or encountering SQL injection, XSS, CSRF, nonce errors.
templates/plugin-psr4/src/Frontend/Assets.php
View on GitHub<?php
/**
* Frontend Assets
*
* @package MyPSR4Plugin\Frontend
*/
namespace MyPSR4Plugin\Frontend;
use MyPSR4Plugin\PostTypes\Book;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Assets class
*/
class Assets {
/**
* Single instance
*
* @var Assets
*/
private static $instance = null;
/**
* Get instance
*
* @return Assets
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
private function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
}
/**
* Enqueue frontend scripts and styles
*/
public function enqueue_scripts() {
// Only load on single book pages
if ( is_singular( Book::POST_TYPE ) ) {
wp_enqueue_style(
'mypp-style',
MYPP_PLUGIN_URL . 'assets/css/style.css',
array(),
MYPP_VERSION
);
wp_enqueue_script(
'mypp-script',
MYPP_PLUGIN_URL . 'assets/js/script.js',
array( 'jquery' ),
MYPP_VERSION,
true
);
}
}
/**
* Enqueue admin scripts and styles
*
* @param string $hook Current admin page hook.
*/
public function enqueue_admin_scripts( $hook ) {
// Only load on book edit pages
if ( 'post.php' !== $hook && 'post-new.php' !== $hook && 'edit.php' !== $hook ) {
return;
}
$screen = get_current_screen();
if ( $screen && Book::POST_TYPE === $screen->post_type ) {
wp_enqueue_style(
'mypp-admin-style',
MYPP_PLUGIN_URL . 'assets/css/admin-style.css',
array(),
MYPP_VERSION
);
wp_enqueue_script(
'mypp-admin-script',
MYPP_PLUGIN_URL . 'assets/js/admin-script.js',
array( 'jquery' ),
MYPP_VERSION,
true
);
// Localize script
wp_localize_script(
'mypp-admin-script',
'myppData',
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'mypp_ajax_nonce' ),
)
);
}
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |