/* ====================================================== 🔥 AI SUMMARY V10 TOPIKSERU (IDN STYLE) ======================================================*/ function portal_ai_summary_v10($content) { if (!is_singular('post') || is_admin()) return $content; global $post; $text = wp_strip_all_tags(strip_shortcodes($post->post_content)); /* =============================== CLEAN DATELINE + NOISE ===============================*/ $text = preg_replace('/^\s*.*?\s[–\-]\s+/u', '', $text); $text = preg_replace('/^[A-Za-z\s\.]+,\s*[A-Za-z\s]+\s[–\-]\s+/u', '', $text); $text = preg_replace('/Topikseru\.com/iu', '', $text); $text = preg_replace('/https?:\/\/\S+/iu', '', $text); $text = preg_replace('/\s+/u', ' ', $text); /* =============================== SPLIT SENTENCE ===============================*/ $sentences = preg_split('/(?<=[.?!])\s+/u', $text); $sentences = array_values(array_filter(array_map('trim', $sentences))); if (count($sentences) < 2) return $content; /* =============================== FILTER DUPLIKAT ===============================*/ $seen = []; $pool = []; foreach ($sentences as $s) { $s = preg_replace('/^[\-•\–\—"\']+\s*/u', '', $s); $s = trim(preg_replace('/\s+/u', ' ', $s)); if (mb_strlen($s) < 50) continue; $hash = md5(mb_strtolower($s)); if (isset($seen[$hash])) continue; $seen[$hash] = true; $pool[] = $s; if (count($pool) >= 3) break; } if (!$pool) return $content; /* =============================== BUILD HTML ===============================*/ $html = '
Intinya Sih
Disclaimer: Ringkasan ini dibuat menggunakan teknologi Artificial Intelligence (AI)
'; return $html . $content; } add_filter('the_content', 'portal_ai_summary_v10', 1); /* ====================================================== CSS AI SUMMARY V10 ======================================================*/ add_action('wp_head', function () { if (!is_single()) return; echo ''; },999);/* ====================================================== INTERNAL LINK (FIXED - TIDAK TERBLOK SUMMARY) ======================================================*/ function portal_internal_link($content) { if (!is_single() || is_admin()) return $content; global $post; $targets = []; foreach ((array)get_the_category($post->ID) as $cat) { $targets[] = ['k'=>$cat->name,'u'=>get_category_link($cat->term_id)]; } foreach ((array)get_the_tags($post->ID) as $tag) { if (str_word_count($tag->name) < 2) continue; $targets[] = ['k'=>$tag->name,'u'=>get_tag_link($tag->term_id)]; } $related = get_posts([ 'post_type'=>'post', 'posts_per_page'=>3, 'post__not_in'=>[$post->ID] ]); foreach ($related as $r) { $targets[] = [ 'k'=>get_the_title($r->ID), 'u'=>get_permalink($r->ID) ]; } $count = 0; foreach ($targets as $t) { if ($count >= 5) break; $content = preg_replace( '/\b('.preg_quote($t['k'],'/').')\b(?![^<]*>)/iu', '$1', $content, 1, $replaced ); if (!empty($replaced)) $count++; } return $content; } add_filter('the_content', 'portal_internal_link', 15);/* ====================================================== SEO + OG CLEAN ======================================================*/ add_action('wp_head', function () { if (!is_single()) return; global $post; $title = get_the_title($post->ID); $desc = wp_trim_words(strip_tags($post->post_content), 28); $img = get_the_post_thumbnail_url($post->ID, 'full'); echo ''; echo ''; echo ''; echo ''; echo ''; }, 5); /* ====================================================== SCHEMA ======================================================*/ add_action('wp_head', function () { if (!is_single()) return; global $post; $schema = [ "@context"=>"https://schema.org", "@type"=>"NewsArticle", "headline"=>get_the_title($post->ID), "datePublished"=>get_the_date('c'), "dateModified"=>get_the_modified_date('c'), "mainEntityOfPage"=>get_permalink($post->ID) ]; echo ''; }, 6);/* ====================================================== OPEN GRAPH ======================================================*/ add_action('wp_head', function () { if (!is_single()) return; global $post; $title = get_the_title($post->ID); $desc = wp_trim_words(strip_tags($post->post_content), 28); $url = get_permalink($post->ID); $img = get_the_post_thumbnail_url($post->ID, 'full'); if (!$img) { $img = 'https://via.placeholder.com/1200x630.png?text=No+Image'; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; }, 1); Komentar di: Damkar Medan Pastikan Tak Ada Korban Jiwa dalam Kebakaran Pabrik Sandal Swallow di Medan https://topikseru.com/daerah/kebakaran-pabrik-sandal-medan-deli/ Portal Berita Terkini dari Medan untuk Sumatera Utara Wed, 28 Jan 2026 09:22:25 +0000 hourly 1 https://wordpress.org/?v=7.0