is_wiki_context() ) return; // Dashicons on frontend wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'wmw-frontend', WMW_URL . 'assets/css/frontend.css', [ 'dashicons' ], WMW_VERSION ); wp_enqueue_script( 'wmw-frontend', WMW_URL . 'assets/js/frontend.js', [ 'jquery' ], WMW_VERSION, true ); wp_localize_script( 'wmw-frontend', 'WMW', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wmw_search' ), 'l10n' => [ 'no_results' => __( 'Keine Ergebnisse gefunden.', 'wp-multi-wiki' ), 'searching' => __( 'Suche …', 'wp-multi-wiki' ), 'navigation' => __( 'Navigation', 'wp-multi-wiki' ), ], ] ); } /* ── Admin Assets ───────────────────────────────────────────── */ public function admin_assets( string $hook ): void { $screen = get_current_screen(); if ( ! $screen ) return; $is_wmw = str_contains( $hook, 'wp-multi-wiki' ) || str_contains( $hook, 'wmw-settings' ) || in_array( $screen->post_type, [ 'wmw_wiki', 'wmw_article' ], true ) || in_array( $screen->taxonomy ?? '', [ 'wmw_category', 'wmw_tag' ], true ); if ( ! $is_wmw ) return; wp_enqueue_style( 'wmw-admin', WMW_URL . 'assets/css/admin.css', [], WMW_VERSION ); wp_enqueue_script( 'wmw-admin', WMW_URL . 'assets/js/admin.js', [ 'jquery' ], WMW_VERSION, true ); } /* ── Helpers ────────────────────────────────────────────────── */ private function is_wiki_context(): bool { return is_singular( [ 'wmw_wiki', 'wmw_article' ] ) || is_post_type_archive( 'wmw_wiki' ) || is_tax( [ 'wmw_category', 'wmw_tag' ] ); } public function action_links( array $links ): array { array_unshift( $links, '' . __( 'Dashboard', 'wp-multi-wiki' ) . '' ); return $links; } }