

// 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://fabiosonego.com/wp-sitemap.xsl" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://fabiosonego.com/</loc><lastmod>2026-05-04T14:30:09+02:00</lastmod></url><url><loc>https://fabiosonego.com/info/</loc><lastmod>2026-04-30T09:24:51+02:00</lastmod></url><url><loc>https://fabiosonego.com/exhibitions/</loc><lastmod>2024-12-17T16:36:28+01:00</lastmod></url><url><loc>https://fabiosonego.com/works/</loc><lastmod>2026-04-30T09:11:29+02:00</lastmod></url><url><loc>https://fabiosonego.com/you-dont-know-the-meaning-of-the-word-neighbour-basel-2022/</loc><lastmod>2024-11-11T16:50:43+01:00</lastmod></url><url><loc>https://fabiosonego.com/when-the-water-loves-fire-basel-2022/</loc><lastmod>2025-10-17T11:30:52+02:00</lastmod></url><url><loc>https://fabiosonego.com/mimi-micro-mama-macro-venezia-2023/</loc><lastmod>2025-10-17T11:30:58+02:00</lastmod></url><url><loc>https://fabiosonego.com/projects-performances/</loc><lastmod>2024-11-11T17:06:01+01:00</lastmod></url><url><loc>https://fabiosonego.com/ieri-era-domani-sant-andrea-venezia-2025/</loc><lastmod>2025-10-20T11:34:35+02:00</lastmod></url></urlset>
