plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the public-facing side of the site. * * Only enqueues on singular pages (posts, pages, custom post types) * where schema markup is rendered. */ public function enqueue_styles() { if ( ! is_singular() ) { return; } wp_enqueue_style( 'ai-schema-gen-public', plugin_dir_url( __FILE__ ) . 'assets/css/public.css', array(), $this->version ); } /** * Register the JavaScript for the public-facing side of the site. * * Only enqueues on singular pages. Provides basic data via * wp_localize_script for any future frontend functionality. */ public function enqueue_scripts() { if ( ! is_singular() ) { return; } wp_enqueue_script( 'ai-schema-gen-public', plugin_dir_url( __FILE__ ) . 'assets/js/public.js', array(), $this->version, true ); wp_localize_script( 'ai-schema-gen-public', 'schemaAiPublic', array( 'ajaxUrl' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), 'nonce' => wp_create_nonce( 'schema_ai_public' ), ) ); } }