<?php /** * Plugin Name: Absolute Sticky Posts * Description: Force sticky posts to appear at the very top of category archives, above newer non-sticky posts. * Version: 4.7.0 * Author: cnstudio * * v4.7: Constrain article title (header.entry-header) max-width to match article * content width across all viewports (1100/1340/1400px). Previously the * title could be wider than the body content, breaking the visual column. * v4.3: Redesigned category archive layout — wider cards, consistent image ratio, * centered hero, proper sidebar alignment. * v4.2: Added /all-courses/ (page 201) full-width layout override. * v4.6: P28 — Dark-theme table styling for article content (was: light bg + dark text clashed with site's dark navy theme). * v4.1: Auto-clean broken snippet 27373 (P26 corrupted appended content). * Triggered by ?p26_cleanup=1 in URL, uses $wpdb to truncate the broken appended bytes. */ if (!defined('ABSPATH')) { exit; } // === EMERGENCY: Clean broken snippet 27373 via wpdb === // The snippet 27373 had ~10498 bytes of P26 CSS appended via REST API which // got rendered as text on the page (Elementor Pro stripped <style>/<script> // tags from the appended content). This trigger removes the broken appended // content by truncating at the last </script> before the P26 marker. // If the structure is still broken, also try to clear the snippet entirely. add_action('init', function() { if (!isset($_GET['p26_cleanup']) || $_GET['p26_cleanup'] !== '1') { return; } if (!current_user_can('manage_options')) { return; } global $wpdb; $post_id = 27373; $row = $wpdb->get_row($wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = '_elementor_code'", $post_id )); if (!$row) { return; } $code = $row->meta_value; $p26 = strpos($code, '<!-- P26:'); if ($p26 === false) { return; } $before = substr($code, 0, $p26); $last = strrpos($before, '</script>'); $clean = $last === false ? '' : substr($before, 0, $last + strlen('</script>')); $before_len = strlen($code); // v4.1.1: If cleaned content doesn't start with <style>, the structure // is broken. Just nuke it. if (strpos(trim($clean), '<style') !== 0) { $clean = ''; } $wpdb->update( $wpdb->postmeta, ['meta_value' => $clean], ['post_id' => $post_id, 'meta_key' => '_elementor_code'], ['%s'], ['%d', '%s'] ); add_action('wp_footer', function() use ($clean, $before_len) { echo '<!-- p26_cleanup: BEFORE len=' . $before_len . ' AFTER len=' . strlen($clean) . ' -->'; }); }); // === PART 1: P26 1920px LAYOUT CSS (in wp_head for early load) === add_action('wp_head', function() { ?> <style id="p26-1920-layout"> /* === WIDE-SCREEN CONTAINER MAX-WIDTHS (>=1500px) === */ @media (min-width: 1500px) { .elementor-section.elementor-section-boxed > .elementor-container, .elementor-section .elementor-container { max-width: 1800px !important; margin-left: auto !important; margin-right: auto !important; } .ast-container, .site-content > .ast-container, .site-header > .ast-container, .site-footer > .ast-container { max-width: 1800px !important; margin-left: auto !important; margin-right: auto !important; } body.single-post .site-content, body.archive .site-content, body.category .site-content { max-width: 100% !important; } /* Elementor stretched sections: center their inner container */ .elementor-section.elementor-section-stretched .elementor-container { max-width: 1800px !important; margin-left: auto !important; margin-right: auto !important; } /* 2K / 4K: when viewport is much wider than 1800, let the container expand proportionally so it stays centered and uses more of the screen. */ @media (min-width: 2000px) { .ast-container, .site-content > .ast-container, .site-header > .ast-container, .site-footer > .ast-container, .elementor-section .elementor-container, .elementor-section.elementor-section-stretched .elementor-container { max-width: min(92vw, 2400px) !important; } } @media (min-width: 2700px) { .ast-container, .site-content > .ast-container, .site-header > .ast-container, .site-footer > .ast-container, .elementor-section .elementor-container, .elementor-section.elementor-section-stretched .elementor-container { max-width: min(94vw, 3000px) !important; } } } /* === SINGLE POST ARTICLE BODY - 1280-1400px responsive === */ @media (min-width: 1200px) and (max-width: 1499px) { html body.single-post.single .entry-content, html body.single-post.single .ast-article-single .entry-content, body.wp-singular.single.single-post .entry-content, html body.single-post.single .post-thumb-img-content, body.wp-singular.single.single-post .post-thumb-img-content, html body.single-post.single header.entry-header, body.wp-singular.single.single-post header.entry-header { max-width: 1100px !important; margin-left: auto !important; margin-right: auto !important; } } @media (min-width: 1500px) and (max-width: 1799px) { html body.single-post.single .entry-content, html body.single-post.single .ast-article-single .entry-content, body.wp-singular.single.single-post .entry-content, html body.single-post.single .post-thumb-img-content, body.wp-singular.single.single-post .post-thumb-img-content, html body.single-post.single header.entry-header, body.wp-singular.single.single-post header.entry-header { max-width: 1340px !important; margin-left: auto !important; margin-right: auto !important; } } @media (min-width: 1800px) { html body.single-post.single .entry-content, html body.single-post.single .ast-article-single .entry-content, body.wp-singular.single.single-post .entry-content, html body.single-post.single .post-thumb-img-content, body.wp-singular.single.single-post .post-thumb-img-content, html body.single-post.single header.entry-header, body.wp-singular.single.single-post header.entry-header { max-width: 1400px !important; margin-left: auto !important; margin-right: auto !important; } } /* === CATEGORY ARCHIVE - 3 COL + RIGHT SIDEBAR (>=1500px) === */ @media (min-width: 1500px) { body.category .elementor-element-w_posts, body.archive .elementor-element-w_posts { flex: 0 0 calc(100% - 360px) !important; max-width: calc(100% - 360px) !important; width: calc(100% - 360px) !important; } body.category .elementor-section .elementor-column[data-col="100"], body.archive .elementor-section .elementor-column[data-col="100"] { display: flex !important; flex-wrap: wrap !important; align-items: flex-start !important; } body.category .elementor-section .elementor-column[data-col="100"] > .elementor-widget-wrap, body.archive .elementor-section .elementor-column[data-col="100"] > .elementor-widget-wrap { width: calc(100% - 360px) !important; flex: 0 0 calc(100% - 360px) !important; padding: 0 20px 0 0 !important; } .cn-studio-archive-sidebar { position: relative; width: 340px !important; flex: 0 0 340px !important; margin-left: 20px; } .cn-studio-archive-sidebar > div { background: rgba(255, 255, 255, 0.03) !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; border-radius: 16px !important; padding: 24px 22px !important; margin-bottom: 20px !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); } .cn-studio-archive-sidebar h4 { color: #fff !important; font-size: 14px !important; font-weight: 600 !important; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 16px !important; padding: 0 0 12px !important; border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important; } .cn-studio-archive-sidebar ul { list-style: none !important; padding: 0 !important; margin: 0 !important; } .cn-studio-archive-sidebar li { padding: 10px 0 !important; border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important; } .cn-studio-archive-sidebar li:last-child { border-bottom: 0 !important; } .cn-studio-archive-sidebar a { color: rgba(255, 255, 255, 0.78) !important; text-decoration: none !important; font-size: 14px !important; line-height: 1.5 !important; display: block; transition: color 0.2s; } .cn-studio-archive-sidebar a:hover { color: #a29bfe !important; } .cn-studio-archive-sidebar .cat-mini { display: inline-block; padding: 4px 10px; margin: 4px 4px 4px 0; background: rgba(108, 92, 231, 0.15); border: 1px solid rgba(108, 92, 231, 0.3); border-radius: 999px; color: #c4baff !important; font-size: 12px !important; } .cn-studio-archive-sidebar .newsletter-box { background: linear-gradient(135deg, rgba(108,92,231,0.18) 0%, rgba(0,212,255,0.12) 100%) !important; border: 1px solid rgba(108, 92, 231, 0.3) !important; } .cn-studio-archive-sidebar .newsletter-box p { color: rgba(255, 255, 255, 0.78) !important; font-size: 13px !important; line-height: 1.55 !important; margin: 0 0 14px !important; } .cn-studio-archive-sidebar .newsletter-box input { width: 100% !important; background: rgba(10, 13, 58, 0.6) !important; border: 1px solid rgba(255, 255, 255, 0.12) !important; color: #fff !important; padding: 10px 12px !important; border-radius: 8px !important; font-size: 13px !important; margin-bottom: 8px !important; box-sizing: border-box !important; } .cn-studio-archive-sidebar .newsletter-box button { width: 100% !important; background: linear-gradient(135deg, #6c5ce7 0%, #00d4ff 100%) !important; color: #fff !important; border: 0 !important; padding: 10px 14px !important; border-radius: 8px !important; font-size: 13px !important; font-weight: 600 !important; cursor: pointer !important; } } /* === HEADER LAYOUT for 1920px === */ @media (min-width: 1500px) { header.site-header#masthead .ast-container, header.ast-main-header-wrap .ast-container, .site-header > .ast-container { max-width: 1800px !important; padding-left: 60px !important; padding-right: 60px !important; } .site-branding { flex: 0 0 auto !important; } .main-header-bar-navigation, .ast-header-woo-cart, .ast-masthead-custom-menu-items { flex: 1 1 auto !important; } .main-header-menu > .menu-item > a { padding: 0 18px !important; } } /* === WIDE-SCREEN TYPOGRAPHY === */ @media (min-width: 1500px) { html body.single-post.single .entry-content p, body.wp-singular.single.single-post .entry-content p { font-size: 18px !important; line-height: 1.85 !important; } html body.single-post.single .entry-content h2, body.wp-singular.single.single-post .entry-content h2 { font-size: 32px !important; margin-top: 56px !important; margin-bottom: 24px !important; } html body.single-post.single .entry-content h3, body.wp-singular.single.single-post .entry-content h3 { font-size: 24px !important; margin-top: 40px !important; margin-bottom: 18px !important; } } /* === ALL-COURSES PAGE (page 201) - Expand to 1800px on wide === */ @media (min-width: 1500px) { body.page-id-201 .elementor-section.elementor-section-boxed > .elementor-container, body.page-id-201 .elementor-section .elementor-container, body.page-id-201 .ast-container, body.page-id-201 .site-content > .ast-container, body.page-id-201 .ld-course-list-content, body.page-id-201 .ld-course-list-items.row, body.page-id-201 #ld-course-list-content-c4556973bc2af538cafa19d9bc0a5522, body.page-id-201 .ld-course-list { max-width: 1800px !important; width: 100% !important; margin-left: auto !important; margin-right: auto !important; } body.page-id-201 .ld-course-list-items.row { display: flex !important; flex-wrap: wrap !important; gap: 28px !important; margin: 0 !important; } body.page-id-201 .ld-course-list-items.row .ld_course_grid.col-md-4 { flex: 1 1 calc(33.333% - 19px) !important; max-width: calc(33.333% - 19px) !important; width: auto !important; min-width: 0 !important; padding: 0 !important; } body.page-id-201 .elementor-section .elementor-container { padding-left: 40px !important; padding-right: 40px !important; } /* 2K/4K: scale up proportionally with min(92vw, 2400px) */ } @media (min-width: 2000px) { body.page-id-201 .elementor-section.elementor-section-boxed > .elementor-container, body.page-id-201 .elementor-section .elementor-container, body.page-id-201 .ast-container, body.page-id-201 .site-content > .ast-container, body.page-id-201 .ld-course-list-content, body.page-id-201 .ld-course-list-items.row, body.page-id-201 .ld-course-list { max-width: min(92vw, 2400px) !important; } } @media (min-width: 2700px) { body.page-id-201 .elementor-section.elementor-section-boxed > .elementor-container, body.page-id-201 .elementor-section .elementor-container, body.page-id-201 .ast-container, body.page-id-201 .site-content > .ast-container, body.page-id-201 .ld-course-list-content, body.page-id-201 .ld-course-list-items.row, body.page-id-201 .ld-course-list { max-width: min(94vw, 3000px) !important; } } /* Tablet (1200-1499) - slightly wider but not 1800 */ @media (min-width: 1200px) and (max-width: 1499px) { body.page-id-201 .elementor-section.elementor-section-boxed > .elementor-container, body.page-id-201 .ast-container, body.page-id-201 .ld-course-list { max-width: 1200px !important; margin-left: auto !important; margin-right: auto !important; } } /* === CATEGORY ARCHIVE - CLEAN LAYOUT v4.3 (>=1500px) === */ @media (min-width: 1500px) { /* Release the w_posts widget constraint so it fills the widget-wrap (1392px). Old v4.1 set max-width: calc(100% - 360px) which double-subtracted and left only 1008px. */ body.category .elementor-element-w_posts, body.archive .elementor-element-w_posts { flex: 0 0 100% !important; max-width: 100% !important; width: 100% !important; } body.category .elementor-element-w_posts .elementor-widget-container, body.archive .elementor-element-w_posts .elementor-widget-container { width: 100% !important; max-width: 100% !important; } body.category .elementor-posts-container.elementor-grid, body.archive .elementor-posts-container.elementor-grid { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 28px !important; } /* Center the cards container on 2K/4K too (parent already has margin auto via the wide-screen rule) */ /* Card body: consistent padding, tighter spacing */ body.category .elementor-post, body.archive .elementor-post { background: rgba(255, 255, 255, 0.025) !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; border-radius: 16px !important; padding: 0 !important; overflow: hidden !important; transition: all 0.25s ease !important; display: flex !important; flex-direction: column !important; } body.category .elementor-post:hover, body.archive .elementor-post:hover { border-color: rgba(88, 101, 242, 0.4) !important; transform: translateY(-3px) !important; box-shadow: 0 16px 40px -12px rgba(88, 101, 242, 0.25) !important; } /* Thumbnail: fixed aspect ratio, fills the top of card */ body.category .elementor-post__thumbnail, body.archive .elementor-post__thumbnail { width: 100% !important; aspect-ratio: 16 / 10 !important; height: auto !important; max-height: none !important; overflow: hidden !important; position: relative !important; margin: 0 !important; border-radius: 0 !important; background: rgba(15, 18, 60, 0.6) !important; } body.category .elementor-post__thumbnail img, body.archive .elementor-post__thumbnail img { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; max-height: none !important; object-fit: cover !important; object-position: center !important; transform: none !important; } /* Card text area */ body.category .elementor-post__text, body.archive .elementor-post__text { padding: 22px 22px 24px !important; display: flex !important; flex-direction: column !important; flex: 1 1 auto !important; gap: 12px !important; } /* Title */ body.category .elementor-post__title, body.archive .elementor-post__title { font-size: 18px !important; line-height: 1.45 !important; font-weight: 600 !important; color: #fff !important; margin: 0 !important; padding: 0 !important; /* Clamp to 2 lines */ display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; } body.category .elementor-post__title a, body.archive .elementor-post__title a { color: #fff !important; text-decoration: none !important; } /* Excerpt */ body.category .elementor-post__excerpt, body.archive .elementor-post__excerpt { font-size: 14px !important; line-height: 1.6 !important; color: rgba(255, 255, 255, 0.65) !important; margin: 0 !important; padding: 0 !important; display: -webkit-box !important; -webkit-line-clamp: 3 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; } /* Meta footer: date / read more row */ body.category .elementor-post__meta-data, body.archive .elementor-post__meta-data { margin-top: auto !important; padding-top: 16px !important; border-top: 1px solid rgba(255, 255, 255, 0.06) !important; display: flex !important; align-items: center !important; justify-content: space-between !important; font-size: 12px !important; color: rgba(255, 255, 255, 0.5) !important; } body.category .elementor-post__read-more, body.archive .elementor-post__read-more { color: #8b95ff !important; font-size: 13px !important; font-weight: 500 !important; text-decoration: none !important; display: inline-flex !important; align-items: center !important; gap: 4px !important; } /* Sidebar: tighter, better visual */ .cn-studio-archive-sidebar { width: 340px !important; flex: 0 0 340px !important; } } /* Tablet (1200-1499) - 2 col + sidebar hidden */ @media (min-width: 1200px) and (max-width: 1499px) { body.category .elementor-posts-container.elementor-grid, body.archive .elementor-posts-container.elementor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 24px !important; } } /* === MOBILE REVERT === */ @media (max-width: 1499px) { .cn-studio-archive-sidebar { display: none !important; } } /* === ARTICLE TABLE DARK-THEME STYLING (P28) === */ /* WordPress default table block uses light backgrounds + dark text that clashes with the site's dark navy theme. Override to ensure all article-content tables have white text on dark backgrounds. */ .entry-content table, .entry-content figure.wp-block-table table, .entry-content .wp-block-table, .elementor-widget-theme-post-content table, .post-content table, .elementor-widget-container table, article .elementor-widget-container table, .ast-article-single table { background: rgba(255, 255, 255, 0.04) !important; color: #ffffff !important; border-collapse: separate !important; border-spacing: 0 !important; border: 1px solid rgba(255, 255, 255, 0.12) !important; border-radius: 12px !important; overflow: hidden !important; width: 100% !important; margin: 24px 0 !important; font-size: 15px !important; } /* Override WordPress 'is-style-stripes' zebra pattern that adds light row backgrounds. Use !important to beat core block styles. */ .entry-content table.is-style-stripes, .entry-content .wp-block-table.is-style-stripes, .entry-content figure.wp-block-table.is-style-stripes table, .entry-content .is-style-stripes { border-collapse: separate !important; background: rgba(255, 255, 255, 0.04) !important; } .entry-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd), .entry-content .is-style-stripes tbody tr:nth-child(odd), .entry-content .wp-block-table.is-style-stripes tbody tr:nth-child(even), .entry-content .is-style-stripes tbody tr:nth-child(even) { background-color: transparent !important; } .entry-content table thead th, .entry-content .wp-block-table thead th, .entry-content figure.wp-block-table thead th, .elementor-widget-theme-post-content table thead th, .post-content table thead th, .elementor-widget-container table thead th, article .elementor-widget-container table thead th, .ast-article-single table thead th { background: rgba(139, 149, 255, 0.18) !important; background: linear-gradient(135deg, rgba(139, 149, 255, 0.20), rgba(88, 101, 242, 0.15)) !important; color: #ffffff !important; font-weight: 600 !important; padding: 14px 18px !important; text-align: left !important; border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important; border-right: 1px solid rgba(255, 255, 255, 0.08) !important; letter-spacing: 0.3px !important; } .entry-content table thead th:last-child, .entry-content .wp-block-table thead th:last-child, .entry-content figure.wp-block-table thead th:last-child, .elementor-widget-theme-post-content table thead th:last-child, .post-content table thead th:last-child, .elementor-widget-container table thead th:last-child, article .elementor-widget-container table thead th:last-child, .ast-article-single table thead th:last-child { border-right: none !important; } .entry-content table tbody td, .entry-content .wp-block-table tbody td, .entry-content figure.wp-block-table tbody td, .elementor-widget-theme-post-content table tbody td, .post-content table tbody td, .elementor-widget-container table tbody td, article .elementor-widget-container table tbody td, .ast-article-single table tbody td { background-color: transparent !important; background: transparent !important; color: #ffffff !important; padding: 14px 18px !important; border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important; border-right: 1px solid rgba(255, 255, 255, 0.04) !important; vertical-align: middle !important; } .entry-content table tbody td:last-child, .entry-content .wp-block-table tbody td:last-child, .entry-content figure.wp-block-table tbody td:last-child, .elementor-widget-theme-post-content table tbody td:last-child, .post-content table tbody td:last-child, .elementor-widget-container table tbody td:last-child, article .elementor-widget-container table tbody td:last-child, .ast-article-single table tbody td:last-child { border-right: none !important; } .entry-content table tbody tr:last-child td, .entry-content .wp-block-table tbody tr:last-child td, .entry-content figure.wp-block-table tbody tr:last-child td, .elementor-widget-theme-post-content table tbody tr:last-child td, .post-content table tbody tr:last-child td, .elementor-widget-container table tbody tr:last-child td, article .elementor-widget-container table tbody tr:last-child td, .ast-article-single table tbody tr:last-child td { border-bottom: none !important; } /* Custom alternating dark stripes (override WP's light stripes) */ .entry-content table tbody tr:nth-child(odd) td, .entry-content .wp-block-table tbody tr:nth-child(odd) td, .entry-content figure.wp-block-table tbody tr:nth-child(odd) td, .elementor-widget-theme-post-content table tbody tr:nth-child(odd) td, .post-content table tbody tr:nth-child(odd) td, .elementor-widget-container table tbody tr:nth-child(odd) td, article .elementor-widget-container table tbody tr:nth-child(odd) td, .ast-article-single table tbody tr:nth-child(odd) td { background-color: rgba(255, 255, 255, 0.02) !important; background: rgba(255, 255, 255, 0.02) !important; } .entry-content table tbody tr:nth-child(even) td, .entry-content .wp-block-table tbody tr:nth-child(even) td, .entry-content figure.wp-block-table tbody tr:nth-child(even) td, .elementor-widget-theme-post-content table tbody tr:nth-child(even) td, .post-content table tbody tr:nth-child(even) td, .elementor-widget-container table tbody tr:nth-child(even) td, article .elementor-widget-container table tbody tr:nth-child(even) td, .ast-article-single table tbody tr:nth-child(even) td { background-color: rgba(255, 255, 255, 0.06) !important; background: rgba(255, 255, 255, 0.06) !important; } .entry-content table tbody tr:hover td, .entry-content .wp-block-table tbody tr:hover td, .entry-content figure.wp-block-table tbody tr:hover td, .elementor-widget-theme-post-content table tbody tr:hover td, .post-content table tbody tr:hover td, .elementor-widget-container table tbody tr:hover td, article .elementor-widget-container table tbody tr:hover td, .ast-article-single table tbody tr:hover td { background-color: rgba(139, 149, 255, 0.12) !important; background: rgba(139, 149, 255, 0.12) !important; } .entry-content table strong, .entry-content .wp-block-table strong, .entry-content figure.wp-block-table strong, .elementor-widget-theme-post-content table strong, .post-content table strong, .elementor-widget-container table strong, article .elementor-widget-container table strong, .ast-article-single table strong { color: #ffffff !important; font-weight: 600 !important; } </style> <?php }, 999); // === PART 2: STICKY POST REORDER + SIDEBAR INJECTION (in wp_footer) === add_action('wp_footer', function() { $sticky = get_option('sticky_posts'); $has_sticky = !empty($sticky) && is_array($sticky); $is_tax = is_category() || is_tag() || is_tax(); if (!$has_sticky || !$is_tax) { return; } $sticky_ids = array_map('intval', $sticky); ?> <script id="absolute-sticky-reorder"> (function() { var stickyIds = <?php echo json_encode($sticky_ids); ?>; var stickySet = {}; stickyIds.forEach(function(id) { stickySet[id] = true; }); var lastReorderSig = ''; function extractId(el) { if (!el) return 0; var id = parseInt(el.getAttribute('data-post-id') || el.getAttribute('data-id') || '0', 10); if (id) return id; var m = (el.className || '').match(/post-(\d+)/); if (m) return parseInt(m[1], 10); return 0; } function reorder() { var containers = document.querySelectorAll( '.elementor-posts-container, .elementor-loop-container, .elementor-posts, ul.products, .posts-loop, .elementor-widget-posts .elementor-widget-container, .elementor-widget-loop-grid .elementor-widget-container' ); containers.forEach(function(container) { if (!container) return; var children = Array.prototype.slice.call(container.children); var articles = children.filter(function(el) { return el.tagName === 'ARTICLE' || el.classList.contains('e-loop-item') || el.classList.contains('post'); }); if (articles.length < 2) return; var sig = articles.map(extractId).join(','); if (sig === lastReorderSig) return; var stickyArticles = []; var otherArticles = []; articles.forEach(function(a) { var id = extractId(a); if (stickySet[id]) stickyArticles.push(a); else otherArticles.push(a); }); if (stickyArticles.length > 0) { var frag = document.createDocumentFragment(); stickyArticles.concat(otherArticles).forEach(function(a) { frag.appendChild(a); }); container.appendChild(frag); lastReorderSig = stickyArticles.map(extractId).concat(otherArticles.map(extractId)).join(','); } }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', reorder); } else { reorder(); } try { var observer = new MutationObserver(function() { reorder(); }); observer.observe(document.body, { childList: true, subtree: true }); } catch (e) {} setInterval(reorder, 500); // === Sidebar injection === function injectSidebar() { if (window.innerWidth < 1500) return; if (!document.body.classList.contains('category') && !document.body.classList.contains('tag') && !document.body.classList.contains('tax-ld_course_category')) return; if (document.querySelector('.cn-studio-archive-sidebar')) return; var postsWidget = document.querySelector('.elementor-element-w_posts'); if (!postsWidget) return; var column = postsWidget.closest('.elementor-column'); if (!column) return; var columnWrap = column.querySelector('.elementor-widget-wrap') || column.querySelector('.elementor-column-wrap'); if (!columnWrap) return; var sidebar = document.createElement('aside'); sidebar.className = 'cn-studio-archive-sidebar'; sidebar.innerHTML = [ '<div>', '<h4>📑 选品分类</h4>', '<div>', '<a class="cat-mini" href="/category/market-selection/">选品研究</a>', '<a class="cat-mini" href="/category/dtc/">独立站</a>', '<a class="cat-mini" href="/category/amazon/">亚马逊</a>', '<a class="cat-mini" href="/">全部</a>', '</div>', '</div>', '<div class="newsletter-box">', '<h4 style="border-color:rgba(255,255,255,0.18);">📬 每周三早 8 点</h4>', '<p>跨境选品研究 · 数据驱动的出海判断</p>', '<input type="email" placeholder="你的邮箱">', '<button>订阅周报</button>', '</div>', '<div>', '<h4>🔥 最新研究</h4>', '<ul>', '<li><a href="/cold-plunge-sauna/">冷浴+桑拿:70% 增长背后的 8 个机会</a></li>', '<li><a href="/clarity-5-heatmap-types-guide/">Clarity 5 类热力图完全指南</a></li>', '<li><a href="/distributor-cooperation-complete-guide/">选品合作:把研究变成 SKU</a></li>', '</ul>', '</div>', ].join(''); columnWrap.parentNode.insertBefore(sidebar, columnWrap.nextSibling); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', injectSidebar); } else { injectSidebar(); } try { var obs = new MutationObserver(function() { injectSidebar(); }); document.addEventListener('DOMContentLoaded', function() { obs.observe(document.body, { childList: true, subtree: true }); }); } catch (e) {} })(); </script> <?php }, 999); https://cnstudio.com/wp-sitemap-posts-post-1.xmlhttps://cnstudio.com/wp-sitemap-posts-page-1.xmlhttps://cnstudio.com/wp-sitemap-posts-product-1.xmlhttps://cnstudio.com/wp-sitemap-posts-sfwd-courses-1.xmlhttps://cnstudio.com/wp-sitemap-posts-sfwd-lessons-1.xmlhttps://cnstudio.com/wp-sitemap-posts-sfwd-topic-1.xmlhttps://cnstudio.com/wp-sitemap-posts-elementor-hf-1.xmlhttps://cnstudio.com/wp-sitemap-posts-cartflows_step-1.xmlhttps://cnstudio.com/wp-sitemap-taxonomies-category-1.xmlhttps://cnstudio.com/wp-sitemap-taxonomies-product_cat-1.xmlhttps://cnstudio.com/wp-sitemap-taxonomies-ld_course_category-1.xmlhttps://cnstudio.com/wp-sitemap-users-1.xml