/* core builder */ function scg_build_for_post($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return false; if (wp_is_post_revision($post_id)) return false; if (get_post_type($post_id) !== 'post') return false; $title = get_the_title($post_id); $post_link = get_permalink($post_id); $intros_text = get_option(SCG_OPT_INTROS, ''); $outros_text = get_option(SCG_OPT_OUTROS, ''); $intros = scg_split_units($intros_text); $outros = scg_split_units($outros_text); if (empty($intros)) $intros = array('
{BOLD_TITLE}
'); if (empty($outros)) $outros = array('{BOLD_TITLE}
'); $intro_idx = intval(get_option(SCG_OPT_INTRO_IDX, -1)); $outro_idx = intval(get_option(SCG_OPT_OUTRO_IDX, -1)); $next_intro = ($intro_idx + 1) % count($intros); $next_outro = ($outro_idx + 1) % count($outros); update_option(SCG_OPT_INTRO_IDX, $next_intro); update_option(SCG_OPT_OUTRO_IDX, $next_outro); $intro_tpl = $intros[$next_intro]; $outro_tpl = $outros[$next_outro]; // split keywords for sections $keywords = scg_get_keywords(); $intro_kws = array_slice($keywords, 0, 3); $pros_kws = array_slice($keywords, 3, 3); $cons_kws = array_slice($keywords, 6, 3); $faq_kws = array_slice($keywords, 9, 3); $outro_kws = array_slice($keywords, 12, 2); // remaining keywords for outro // apply placeholders in intro $intro_html = $intro_tpl; foreach ($intro_kws as $i => $kw) { $intro_html = str_replace('{A_KW' . $i . '}', '' . esc_html($title . ' ' . $kw) . '', $intro_html); } $intro_html = str_replace('{BOLD_TITLE}', '' . esc_html($title) . '', $intro_html); // Pros $pros_html = "{BOLD_TITLE} simplifies digital tasks and offers powerful tools. {A_KW0}
Basic features are free; premium upgrades available. {A_KW1}
Install via official stores. {A_KW2}
Regular updates and verified sources ensure safety.
"; $faq_html = $faq_tpl; foreach ($faq_kws as $i => $kw) { $faq_html = str_replace('{A_KW' . $i . '}', '' . esc_html($title . ' ' . $kw) . '', $faq_html); } $faq_html = str_replace('{BOLD_TITLE}', '' . esc_html($title) . '', $faq_html); // Outro $outro_html_final = $outro_tpl; foreach ($outro_kws as $i => $kw) { $outro_html_final = str_replace('{A_KW' . $i . '}', '' . esc_html($title . ' ' . $kw) . '', $outro_html_final); } $outro_html_final = str_replace('{BOLD_TITLE}', '' . esc_html($title) . '', $outro_html_final); // Download section remains unchanged $download_section = "Easy installation on Android and iOS devices ensures quick access to advanced features. Furthermore, users can follow step-by-step instructions seamlessly.
📱 Download from Google Play: Google Play Store
    🍏 Download from App Store: App Store