/* ======================================================
🔥 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 = '
';
foreach ($pool as $point) {
$html .= '' . esc_html($point) . ' ';
}
$html .= '
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);
Transportasi Archives - Topikseru
Portal Berita Terkini dari Medan untuk Sumatera Utara
Fri, 12 Jun 2026 19:20:33 +0000
id
hourly
1
https://wordpress.org/?v=7.0
https://topikseru.com/wp-content/uploads/2026/02/cropped-cropped-cropped-LOGO-UTAMA_TOPIKSERU-32x32.png
Transportasi Archives - Topikseru
32
32
-
KMP Aceh Hebat 2 Terbakar di Pelabuhan Ulee Lheue, ASDP Pastikan Seluruh Korban Dapat Pendampingan
https://topikseru.com/nasional/peristiwa/kmp-aceh-hebat-2-terbakar-banda-aceh/
https://topikseru.com/nasional/peristiwa/kmp-aceh-hebat-2-terbakar-banda-aceh/#respond
Fri, 12 Jun 2026 19:20:33 +0000
https://topikseru.com/?p=48040
Topikseru.com, Banda Aceh – PT ASDP Indonesia Ferry...
The post KMP Aceh Hebat 2 Terbakar di Pelabuhan Ulee Lheue, ASDP Pastikan Seluruh Korban Dapat Pendampingan appeared first on Topikseru .
]]>
https://topikseru.com/nasional/peristiwa/kmp-aceh-hebat-2-terbakar-banda-aceh/feed/
0
-
Listrik Padam Massal, KAI Sumut Pastikan Operasional Kereta Tetap Normal: Jadwal KA Tak Terganggu
https://topikseru.com/bisnis/krl-kai-sumut-normal-saat-listrik-padam-massal-sumatera/
https://topikseru.com/bisnis/krl-kai-sumut-normal-saat-listrik-padam-massal-sumatera/#respond
Sat, 23 May 2026 14:29:07 +0000
https://topikseru.com/?p=45607
Topikseru.com, Medan – PT Kereta Api Indonesia (Persero)...
The post Listrik Padam Massal, KAI Sumut Pastikan Operasional Kereta Tetap Normal: Jadwal KA Tak Terganggu appeared first on Topikseru .
]]>
https://topikseru.com/bisnis/krl-kai-sumut-normal-saat-listrik-padam-massal-sumatera/feed/
0