From f3540a8448f1765f67074eb32d846646d5cbb744 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Sun, 11 Jan 2026 22:55:16 +0700 Subject: [PATCH] feat: Page Editor Phase 3 - SSR integration and navigation - Implement serve_ssr_content with full PageSSR rendering - SEO meta tags (title, description, og:*) - Minimal CSS for bot-friendly presentation - Yoast/Rank Math SEO data integration - Add maybe_serve_ssr_for_bots hook (priority 2 on template_redirect) - Serves SSR for structural pages with WooNooW structure - Serves SSR for CPT items with templates - Add use statements for PageSSR and PlaceholderRenderer - Add Pages link to Appearance submenu in NavigationRegistry - Bump NAV_VERSION to 1.1.0 --- includes/Compat/NavigationRegistry.php | 3 +- includes/Frontend/TemplateOverride.php | 131 +++++++++++++++++++++++-- 2 files changed, 126 insertions(+), 8 deletions(-) diff --git a/includes/Compat/NavigationRegistry.php b/includes/Compat/NavigationRegistry.php index f378916..231efd4 100644 --- a/includes/Compat/NavigationRegistry.php +++ b/includes/Compat/NavigationRegistry.php @@ -13,7 +13,7 @@ if ( ! defined('ABSPATH') ) exit; */ class NavigationRegistry { const NAV_OPTION = 'wnw_nav_tree'; - const NAV_VERSION = '1.0.9'; // Added Help menu + const NAV_VERSION = '1.1.0'; // Added Pages (Page Editor) /** * Initialize hooks @@ -169,6 +169,7 @@ class NavigationRegistry { 'icon' => 'palette', 'children' => [ ['label' => __('General', 'woonoow'), 'mode' => 'spa', 'path' => '/appearance/general'], + ['label' => __('Pages', 'woonoow'), 'mode' => 'spa', 'path' => '/appearance/pages'], ['label' => __('Header', 'woonoow'), 'mode' => 'spa', 'path' => '/appearance/header'], ['label' => __('Footer', 'woonoow'), 'mode' => 'spa', 'path' => '/appearance/footer'], ['label' => __('Shop', 'woonoow'), 'mode' => 'spa', 'path' => '/appearance/shop'], diff --git a/includes/Frontend/TemplateOverride.php b/includes/Frontend/TemplateOverride.php index af1958b..4b725aa 100644 --- a/includes/Frontend/TemplateOverride.php +++ b/includes/Frontend/TemplateOverride.php @@ -1,6 +1,9 @@ build_post_data($post_obj); + } + + $ssr = new PageSSR(); + $html = $ssr->render($structure['sections'], $post_data); + + if (empty($html)) { + return false; + } + + // Get page title + $title = $type === 'page' ? get_the_title($page_id) : ''; + if ($post_obj) { + $title = get_the_title($post_obj); + } + + // SEO data + $seo_title = $title . ' - ' . get_bloginfo('name'); + $seo_description = ''; + + // Try to get Yoast/Rank Math SEO data + if ($type === 'page') { + $seo_title = get_post_meta($page_id, '_yoast_wpseo_title', true) ?: + get_post_meta($page_id, 'rank_math_title', true) ?: $seo_title; + $seo_description = get_post_meta($page_id, '_yoast_wpseo_metadesc', true) ?: + get_post_meta($page_id, 'rank_math_description', true) ?: ''; + } elseif ($post_obj) { + $seo_title = get_post_meta($post_obj->ID, '_yoast_wpseo_title', true) ?: + get_post_meta($post_obj->ID, 'rank_math_title', true) ?: $seo_title; + $seo_description = get_post_meta($post_obj->ID, '_yoast_wpseo_metadesc', true) ?: + get_post_meta($post_obj->ID, 'rank_math_description', true) ?: + wp_trim_words(wp_strip_all_tags($post_obj->post_content), 30); + } + + // Output SSR HTML + ?> + +> + + + + <?php echo esc_html($seo_title); ?> + + + + + + + + + + + + + +> +
+ +
+ + + + ID, $post_type, $post_obj); + } + } } } +