純代碼給DUX主題可通用wordpress添加倒計(jì)時(shí)模塊 可任意自定義倒計(jì)時(shí)內(nèi)容

今天小編為大家?guī)?lái)利用純代碼和worpress自帶的自定義html功能添加倒計(jì)時(shí)模塊,此方法理論上支持所有網(wǎng)站,具體自測(cè)吧。

功能演示

參考本站右側(cè)

wordpress代碼

1、進(jìn)入WordPress網(wǎng)站后臺(tái)

2、選擇外觀-小工具-添加自定義html小工具。

3、填寫如下代碼:

<div class="gn_box">
    <h1><center><font color=#E80017>2</font><font color=#D1002E>0</font><font color=#BA0045>1</font><font color=#A3005C>9</font><font
            color=#8C0073>年</font><font color=#75008A>-</font><font color=#5E00A1>新</font><font
            color=#4700B8>年</font><font color=#3000CF>倒</font><font color=#1900E6>計(jì)</font><font color=#0200FD>時(shí)</font>
    </center></h1>
    <center>
        <div id="CountMsg" class="HotDate">
            <span id="t_d">157 天</span>
            <span id="t_h">9 時(shí)</span>
            <span id="t_m">7 分</span>
            <span id="t_s">42 秒</span>
        </div>
    </center>
    <script type="text/javascript"> function getRTime() {
        var EndTime = new Date('2020/01/25 00:00:00');
        var NowTime = new Date();
        var t = EndTime.getTime() - NowTime.getTime();
        var d = Math.floor(t / 1000 / 60 / 60 / 24);
        var h = Math.floor(t / 1000 / 60 / 60 % 24);
        var m = Math.floor(t / 1000 / 60 % 60);
        var s = Math.floor(t / 1000 % 60);
        document.getElementById("t_d").innerHTML = d + " 天";
        document.getElementById("t_h").innerHTML = h + " 時(shí)";
        document.getElementById("t_m").innerHTML = m + " 分";
        document.getElementById("t_s").innerHTML = s + " 秒";
    }
    setInterval(getRTime, 1000);
    </script>
</div>

4、點(diǎn)擊保存,即可前臺(tái)瀏覽查看。

贊(1)
版權(quán)聲明:本文采用知識(shí)共享 署名4.0國(guó)際許可協(xié)議 [BY-NC-SA] 進(jìn)行授權(quán), 轉(zhuǎn)載請(qǐng)注明出處。
文章名稱:《純代碼給DUX主題可通用wordpress添加倒計(jì)時(shí)模塊 可任意自定義倒計(jì)時(shí)內(nèi)容》
文章鏈接:http://www.lrracing.com/11781.html
【聲明】:國(guó)外主機(jī)測(cè)評(píng)僅分享信息,不參與任何交易,也非中介,所有內(nèi)容僅代表個(gè)人觀點(diǎn),均不作直接、間接、法定、約定的保證,讀者購(gòu)買風(fēng)險(xiǎn)自擔(dān)。一旦您訪問國(guó)外主機(jī)測(cè)評(píng),即表示您已經(jīng)知曉并接受了此聲明通告。
【關(guān)于安全】:任何 IDC商家都有倒閉和跑路的可能,備份永遠(yuǎn)是最佳選擇,服務(wù)器也是機(jī)器,不勤備份是對(duì)自己極不負(fù)責(zé)的表現(xiàn),請(qǐng)保持良好的備份習(xí)慣。