 之前
// ============================================================

// ---- 1) 隐藏所有坏掉的语言切换元素 ----
add_action('wp_head', function() {
    echo '<style>';
    echo '#prisma-translate-flag-container,';
    echo '#prisma_translate_float_bar,';
    echo '.prisna_translate_wrapper,';
    echo '.prisna-floating-bar,';
    echo '.change-language-title .language-flag ';
    echo '{ display:none!important; }';
    echo '</style>';
}, 999);

// ---- 2) 自定义语言下拉菜单 + MyMemory 翻译引擎 ----
add_action('wp_footer', function() {

    if (!is_front_page()) return;

    // 语言列表（国旗emoji + 名称）
    $langs = array(
        'en'    => "\xe2\x9c\x88 English",
        'de'    => "\xf0\x9f\x87\xa9\xf0\x9f\x87\xaa Deutsch",
        'fr'    => "\xf0\x9f\x87\xab\xf0\x9f\x87\xb7 Fran\xc3\xa7ais",
        'es'    => "\xf0\x9f\x87\xaa\xf0\x9f\x87\xb8 Espa\xc3\xb1ol",
        'it'    => "\xf0\x9f\x87\xae\xf0\x9f\x87\xb9 Italiano",
        'pt'    => "\xf0\x9f\x87\xb5\xf0\x9f\x87\xb9 Portugu\xeas",
        'nl'    => "\xf0\x9f\x87\xb3\xf0\x9f\x87\xb1 Nederlands",
        'ru'    => "\xf0\x9f\x87\xb7\xf0\x9f\x87\xba \xd0\xa0\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9",
        'ja'    => "\xf0\x9f\x87\xaf\xf0\x9f\x87\xb5 \xe6\x97\xa6\xe6\x9c\xac\xe8\xaa\x9e",
        'ko'    => "\xf0\x9f\x87\xb0\xf0\x9f\x87\xb7 eded\xb4\xea\xb5\xad\xec\x96\xb4",
        'zh-CN' => "\xf0\x9f\x87\xa8\xf0\x9f\x87\xb3 \xe4\xb8\xad\xe6\x96\x87",
        'tr'    => "\xf0\x9f\x87\xb9\xf0\x9f\x87\xb7 T\xfcrk\xe7e",
    );

    echo '<script>' . PHP_EOL;
    echo '(function(){' . PHP_EOL;

    // 输出语言列表为JS对象
    echo 'var CHITUO_LANGS=' . json_encode($langs) . ';' . PHP_EOL;

    // 完整的切换器和翻译逻辑
    $js = <<<'JSEOF'
var CL={
  k:'chituo_lang_sel',
  api:'https://api.mymemory.translated.net/get',
  sel:'.change-language-cont',
  cur:null,
  list:null,
  init:function(){
    var c=document.querySelector(CL.sel);
    if(!c)return;
    c.innerHTML='';
    var wrap=document.createElement('div');
    wrap.className='cl-wrap';
    wrap.innerHTML='<div class="cl-cur" id="clCur"><span id="clCurTxt"></span><i class="cl-arr">&#9660;</i></div>'
      +'<div class="cl-dp" id="clDp"></div>';
    c.appendChild(wrap);
    CL.cur=document.getElementById('clCur');
    CL.list=document.getElementById('clDp');
    var opts='';
    for(var cd in CHITUO_LANGS){opts+='<a data-c="'+cd+'">'+CHITUO_LANGS[cd]+'</a>';}
    CL.list.innerHTML=opts;
    CL.cur.addEventListener('click',function(e){e.stopPropagation();CL.toggle();});
    CL.list.addEventListener('click',function(e){var t=e.target;if(t.tagName==='A'){CL.choose(t.getAttribute('data-c'));}});
    document.addEventListener('click',function(){CL.close();});
    CL.sync();
    var saved=localStorage.getItem(CL.k)||'en';
    if(saved!=='en'){CL.translate(saved);}
  },
  sync:function(){
    var v=localStorage.getItem(CL.k)||'en';
    document.getElementById('clCurTxt').textContent=CHITUO_LANGS[v]||CHITUO_LANGS['en'];
    var items=CL.list.querySelectorAll('a');
    for(var i=0;i<items.length;i++){items[i].className=items[i].getAttribute('data-c')===v?'cl-a':'';}
  },
  toggle:function(){CL.list.style.display=CL.list.style.display==='block'?'none':'block';},
  close:function(){CL.list.style.display='none';},
  choose:function(cd){
    localStorage.setItem(CL.k,cd);
    CL.close();
    CL.sync();
    if(cd==='en'){location.reload();}
    else{CL.translate(cd);}
  },
  translate:function(tgt){
    var skip={'SCRIPT':1,'STYLE':1,'NOSCRIPT':1};
    var txts=[],nodes=[];
    (function walk(n){
      if(n.nodeType===3&&n.nodeValue&&n.nodeValue.trim().length>1){
        var p=n.parentElement;
        if(p&&!skip[p.tagName]){txts.push(n.nodeValue.trim());nodes.push(n);}
      }else if(n.childNodes){for(var i=0;i<n.childNodes.length;i++){walk(n.childNodes[i]);}}
    })(document.body);

    if(!txts.length)return;
    var bs=8,p=0;
    function doBatch(){
      var sl=txts.slice(p,p+bs);
      if(!sl.length)return;
      var q=sl.join('\n|\n');
      var x=new XMLHttpRequest();
      x.open('GET',CL.api+'?q='+encodeURIComponent(q)+'&langpair=en|'+tgt,true);
      x.onload=function(){
        try{var d=JSON.parse(x.responseText);var tr=d.responseData.translatedText;
          var ps=tr.split('\n|\n');
          for(var j=0;j<Math.min(ps.length,sl.length);j++){
            if(nodes[p+j]&&ps[j]!==sl[j]){nodes[p+j].nodeValue=ps[j];}
          }}catch(e){}
        p+=bs;
        if(p<txts.length){setTimeout(doBatch,250);}else{}
      };
      x.send();
    }
    doBatch();
  }
};

if(document.readyState==='loading'){
  document.addEventListener('DOMContentLoaded',function(){CL.init();});
}else{
  CL.init();
}

JSEOF;

    echo $js . PHP_EOL;
    echo '})();' . PHP_EOL;
    echo '</script>' . PHP_EOL;

    // 内联CSS样式
    echo '<style>' . PHP_EOL;
    echo '.cl-wrap{position:relative;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;}' . PHP_EOL;
    echo '.cl-cur{padding:7px 28px 7px 12px;background:#fff;border:1px solid #ccc;border-radius:3px;cursor:pointer;font-size:13px;color:#333;white-space:nowrap;position:relative;line-height:1.4;}' . PHP_EOL;
    echo '.cl-cur:hover{border-color:#e67e22;}' . PHP_EOL;
    echo '.cl-arr{position:absolute;right:9px;top:50%;margin-top:-2.5px;font-size:11px;color:#999;pointer-events:none;}' . PHP_EOL;
    echo '.cl-dp{display:none;position:absolute;top:100%;left:0;margin-top:3px;background:#fff;border:1px solid #ddd;border-radius:3px;min-width:170px;max-height:320px;overflow-y:auto;z-index:10000;box-shadow:0 3px 10px rgba(0,0,0,0.12);padding:4px 0;}' . PHP_EOL;
    echo '.cl-dp a{display:block;padding:8px 16px;color:#444;text-decoration:none;font-size:13px;border-bottom:1px solid #f5f5f5;transition:background .15s;}' . PHP_EOL;
    echo '.cl-dp a:last-child{border-bottom:none;}' . PHP_EOL;
    echo '.cl-dp a:hover{background:#fef3ec;color:#d35400;}' . PHP_EOL;
    echo '.cl-dp a.cl-a{background:#fdf0e6;color:#e67e22;font-weight:700;}' . PHP_EOL;
    echo '</style>' . PHP_EOL;

}, 999);
?><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="//www.chituorideon.com/wp-content/plugins/all-in-one-seo-pack/sitemap.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<url>
		<loc>https://www.chituorideon.com/sitemap_addl.xml</loc>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_post.xml</loc>
		<priority>0.9</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_page.xml</loc>
		<priority>0.9</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_news.xml</loc>
		<priority>0.9</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_category.xml</loc>
		<priority>0.8</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_post_tag.xml</loc>
		<priority>0.8</priority>
		<changefreq>weekly</changefreq>
	</url>
	<url>
		<loc>https://www.chituorideon.com/sitemap_news_catalog.xml</loc>
		<priority>0.8</priority>
		<changefreq>weekly</changefreq>
	</url>
</urlset>