'; echo '

'; echo ''; echo ''; echo esc_html__( '4WP FAQ', '4wp-faq' ); echo ''; echo '

'; echo '
'; echo ''; } /** * How to add FAQs — replaces the native post-new.php editor. */ public static function render_add_guide() { if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Access denied.', '4wp-faq' ) ); } $settings_url = self::get_page_url(); $list_url = admin_url( 'edit.php?post_type=' . rawurlencode( Settings::get_post_type() ) ); echo '
'; echo '

'; echo ''; echo ''; echo esc_html__( 'Add FAQ', '4wp-faq' ); echo ''; echo '

'; echo '
'; echo '

'; echo esc_html__( 'Do not create registry posts by hand. Questions are collected from pages after a scan.', '4wp-faq' ); echo '

'; echo '
    '; echo '
  1. ' . esc_html__( 'Open a page or post in the editor.', '4wp-faq' ) . '
  2. '; echo '
  3. ' . esc_html__( 'Add a core Accordion (or select an existing one).', '4wp-faq' ) . '
  4. '; echo '
  5. ' . esc_html__( 'In the block toolbar, click Convert to 4WP FAQ, or use Transform to → 4WP FAQ. You can convert several Details or Accordion Items at once.', '4wp-faq' ) . '
  6. '; echo '
  7. ' . esc_html__( 'Write the question in the Accordion heading and the answer in the panel.', '4wp-faq' ) . '
  8. '; echo '
  9. ' . wp_kses( sprintf( /* translators: %s: Settings admin URL */ __( 'Go to FAQ → Settings and click Rescan registry.', '4wp-faq' ), esc_url( $settings_url ) ), [ 'a' => [ 'href' => true ] ] ) . '
  10. '; echo '
  11. ' . wp_kses( sprintf( /* translators: %s: All FAQs admin URL */ __( 'The question appears under All FAQs.', '4wp-faq' ), esc_url( $list_url ) ), [ 'a' => [ 'href' => true ] ] ) . '
  12. '; echo '
'; echo '

'; echo esc_html__( 'FAQ hub page: add 4WP FAQ List and 4WP FAQ Categories. Optional: core Search with “Filter 4WP FAQ List” in the sidebar.', '4wp-faq' ); echo '

'; echo '

'; echo esc_html__( 'Video walkthrough — coming soon.', '4wp-faq' ); echo '

'; echo '
'; echo '
'; } /** * @param string $hook_suffix Current admin page. */ public static function enqueue_admin_assets( $hook_suffix ) { $is_app = self::is_settings_screen( $hook_suffix ); $is_guide = self::is_add_guide_screen( $hook_suffix ); if ( ! $is_app && ! $is_guide ) { return; } if ( ! current_user_can( 'manage_options' ) && ! current_user_can( 'edit_posts' ) ) { return; } $asset_file = FORWP_FAQ_PLUGIN_DIR . 'build/admin/index.asset.php'; if ( ! is_readable( $asset_file ) ) { return; } $asset = include $asset_file; $style_path = FORWP_FAQ_PLUGIN_DIR . 'build/admin/style-index.css'; if ( is_readable( $style_path ) ) { wp_enqueue_style( 'forwp-faq-admin', FORWP_FAQ_PLUGIN_URL . 'build/admin/style-index.css', $is_app ? [ 'wp-components' ] : [], $asset['version'] ); } if ( ! $is_app ) { return; } wp_enqueue_style( 'wp-components' ); wp_enqueue_script( 'forwp-faq-admin', FORWP_FAQ_PLUGIN_URL . 'build/admin/index.js', $asset['dependencies'], $asset['version'], true ); wp_set_script_translations( 'forwp-faq-admin', '4wp-faq' ); wp_localize_script( 'forwp-faq-admin', 'forwpFaqAdmin', [ 'restRoot' => esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), ] ); } /** * Allowed tags for the static admin heading icon SVG. * * @return array> */ private static function heading_svg_allowed_html() { return [ 'svg' => [ 'xmlns' => true, 'viewbox' => true, 'width' => true, 'height' => true, 'fill' => true, 'aria-hidden' => true, ], 'path' => [ 'd' => true, 'fill' => true, ], ]; } /** * @return string */ private static function heading_svg() { return ''; } }