{"id":653263,"date":"2025-09-08T10:12:26","date_gmt":"2025-09-08T02:12:26","guid":{"rendered":"http:\/\/puo.cn\/?p=653263"},"modified":"2025-09-08T10:12:26","modified_gmt":"2025-09-08T02:12:26","slug":"wordpress-%e4%be%a7%e8%be%b9%e6%a0%8fhtml%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"http:\/\/puo.cn\/?p=653263","title":{"rendered":"wordpress \u4fa7\u8fb9\u680fhtml\u63d2\u4ef6"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-653265 aligncenter size-large\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2025\/09\/20250908181107734.png\" alt=\"\" width=\"288\" height=\"687\" srcset=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2025\/09\/20250908181107734.png 288w, http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2025\/09\/20250908181107734-126x300.png 126w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/p>\n<p>&lt;div class=&#8221;stats-widget&#8221;&gt;<br \/>\n&lt;style&gt;<br \/>\n.stats-widget {<br \/>\nfont-family: Arial, sans-serif;<br \/>\nbackground: #ffffff;<br \/>\nborder-radius: 8px;<br \/>\npadding: 15px;<br \/>\ncolor: #333333;<br \/>\nmargin-bottom: 15px;<br \/>\nbox-shadow: 0 2px 10px rgba(0,0,0,0.1);<br \/>\nborder: 1px solid #e0e0e0;<br \/>\n}<\/p>\n<p>.stats-widget h4 {<br \/>\nmargin: 0 0 10px 0;<br \/>\nfont-size: 16px;<br \/>\ntext-align: center;<br \/>\ncolor: #667eea;<br \/>\nfont-weight: 600;<br \/>\n}<\/p>\n<p>.stats-container {<br \/>\ndisplay: flex;<br \/>\nflex-wrap: wrap;<br \/>\nmargin-bottom: 10px;<br \/>\n}<\/p>\n<p>.stat-item {<br \/>\nflex: 1 0 45%;<br \/>\nbackground: #f8f9fa;<br \/>\npadding: 8px;<br \/>\nborder-radius: 6px;<br \/>\ntext-align: center;<br \/>\nmargin: 2.5%;<br \/>\nborder: 1px solid #e9ecef;<br \/>\n}<\/p>\n<p>.stat-label {<br \/>\nfont-size: 12px;<br \/>\ncolor: #6c757d;<br \/>\nmargin-bottom: 4px;<br \/>\n}<\/p>\n<p>.stat-value {<br \/>\nfont-size: 16px;<br \/>\nfont-weight: bold;<br \/>\ncolor: #495057;<br \/>\n}<\/p>\n<p>.weather-container {<br \/>\nbackground: #f8f9fa;<br \/>\npadding: 10px;<br \/>\nborder-radius: 6px;<br \/>\ntext-align: center;<br \/>\nmargin-top: 10px;<br \/>\nborder: 1px solid #e9ecef;<br \/>\n}<\/p>\n<p>.weather-info {<br \/>\ndisplay: flex;<br \/>\nalign-items: center;<br \/>\njustify-content: center;<br \/>\nmargin-top: 5px;<br \/>\n}<\/p>\n<p>.weather-icon {<br \/>\nfont-size: 24px;<br \/>\nmargin-right: 8px;<br \/>\n}<\/p>\n<p>.lunar-date {<br \/>\ntext-align: center;<br \/>\nmargin-top: 10px;<br \/>\nfont-size: 14px;<br \/>\ncolor: #6c757d;<br \/>\nbackground: #f8f9fa;<br \/>\npadding: 8px;<br \/>\nborder-radius: 6px;<br \/>\nborder: 1px solid #e9ecef;<br \/>\n}<br \/>\n&lt;\/style&gt;<\/p>\n<p>&lt;h4&gt;\u65f6\u95f4\u7edf\u8ba1&lt;\/h4&gt;<br \/>\n&lt;div class=&#8221;stats-container&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-item&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u4eca\u5e74\u5269\u4f59&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-value&#8221; id=&#8221;daysRemaining&#8221;&gt;\u8ba1\u7b97\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-item&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u672c\u6708\u5269\u4f59&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-value&#8221; id=&#8221;monthDaysRemaining&#8221;&gt;\u8ba1\u7b97\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-item&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u672c\u5b63\u5ea6\u5269\u4f59&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-value&#8221; id=&#8221;quarterDaysRemaining&#8221;&gt;\u8ba1\u7b97\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-item&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u672c\u5468\u5269\u4f59&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;stat-value&#8221; id=&#8221;weekDaysRemaining&#8221;&gt;\u8ba1\u7b97\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;div class=&#8221;weather-container&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u4e0a\u6d77\u5929\u6c14&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;weather-info&#8221;&gt;<br \/>\n&lt;div class=&#8221;weather-icon&#8221; id=&#8221;weatherIcon&#8221;&gt;\ud83c\udf24\ufe0f&lt;\/div&gt;<br \/>\n&lt;div&gt;<br \/>\n&lt;div id=&#8221;weatherTemp&#8221;&gt;&#8211;\u00b0C&lt;\/div&gt;<br \/>\n&lt;div id=&#8221;weatherDesc&#8221;&gt;\u52a0\u8f7d\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;div class=&#8221;lunar-date&#8221;&gt;<br \/>\n&lt;div class=&#8221;stat-label&#8221;&gt;\u519c\u5386&lt;\/div&gt;<br \/>\n&lt;div id=&#8221;lunarDate&#8221;&gt;\u8ba1\u7b97\u4e2d&#8230;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;script&gt;<br \/>\nfunction calculateTimeRemaining() {<br \/>\nconst today = new Date();<\/p>\n<p>\/\/ \u4eca\u5e74\u5269\u4f59\u5929\u6570<br \/>\nconst endOfYear = new Date(today.getFullYear(), 11, 31);<br \/>\nconst daysLeftYear = Math.ceil((endOfYear &#8211; today) \/ (1000 * 60 * 60 * 24));<br \/>\ndocument.getElementById(&#8216;daysRemaining&#8217;).innerText = daysLeftYear + &#8221; \u5929&#8221;;<\/p>\n<p>\/\/ \u672c\u6708\u5269\u4f59\u5929\u6570<br \/>\nconst endOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);<br \/>\nconst daysLeftMonth = Math.ceil((endOfMonth &#8211; today) \/ (1000 * 60 * 60 * 24));<br \/>\ndocument.getElementById(&#8216;monthDaysRemaining&#8217;).innerText = daysLeftMonth + &#8221; \u5929&#8221;;<\/p>\n<p>\/\/ \u672c\u5b63\u5ea6\u5269\u4f59\u5929\u6570<br \/>\nconst currentQuarter = Math.floor(today.getMonth() \/ 3);<br \/>\nconst endOfQuarter = new Date(today.getFullYear(), (currentQuarter + 1) * 3, 0);<br \/>\nconst daysLeftQuarter = Math.ceil((endOfQuarter &#8211; today) \/ (1000 * 60 * 60 * 24));<br \/>\ndocument.getElementById(&#8216;quarterDaysRemaining&#8217;).innerText = daysLeftQuarter + &#8221; \u5929&#8221;;<\/p>\n<p>\/\/ \u672c\u5468\u5269\u4f59\u5929\u6570<br \/>\nconst endOfWeek = new Date(today);<br \/>\nendOfWeek.setDate(today.getDate() + (7 &#8211; today.getDay()));<br \/>\nconst daysLeftWeek = Math.ceil((endOfWeek &#8211; today) \/ (1000 * 60 * 60 * 24));<br \/>\ndocument.getElementById(&#8216;weekDaysRemaining&#8217;).innerText = daysLeftWeek + &#8221; \u5929&#8221;;<br \/>\n}<\/p>\n<p>function getLunarDate() {<br \/>\n\/\/ \u7b80\u5316\u7248\u519c\u5386\u8ba1\u7b97\uff08\u5b9e\u9645\u5e94\u7528\u4e2d\u5efa\u8bae\u4f7f\u7528\u4e13\u95e8\u7684\u519c\u5386\u5e93\uff09<br \/>\nconst today = new Date();<br \/>\nconst lunarInfo = [<br \/>\n0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,<br \/>\n0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,<br \/>\n0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,<br \/>\n0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,<br \/>\n0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557<br \/>\n];<\/p>\n<p>\/\/ \u7b80\u5316\u8ba1\u7b97\uff0c\u5b9e\u9645\u5e94\u7528\u4e2d\u5e94\u4f7f\u7528\u66f4\u7cbe\u786e\u7684\u7b97\u6cd5<br \/>\nconst lunarMonths = [&#8220;\u6b63\u6708&#8221;, &#8220;\u4e8c\u6708&#8221;, &#8220;\u4e09\u6708&#8221;, &#8220;\u56db\u6708&#8221;, &#8220;\u4e94\u6708&#8221;, &#8220;\u516d\u6708&#8221;, &#8220;\u4e03\u6708&#8221;, &#8220;\u516b\u6708&#8221;, &#8220;\u4e5d\u6708&#8221;, &#8220;\u5341\u6708&#8221;, &#8220;\u51ac\u6708&#8221;, &#8220;\u814a\u6708&#8221;];<br \/>\nconst lunarDays = [&#8220;\u521d\u4e00&#8221;, &#8220;\u521d\u4e8c&#8221;, &#8220;\u521d\u4e09&#8221;, &#8220;\u521d\u56db&#8221;, &#8220;\u521d\u4e94&#8221;, &#8220;\u521d\u516d&#8221;, &#8220;\u521d\u4e03&#8221;, &#8220;\u521d\u516b&#8221;, &#8220;\u521d\u4e5d&#8221;, &#8220;\u521d\u5341&#8221;,<br \/>\n&#8220;\u5341\u4e00&#8221;, &#8220;\u5341\u4e8c&#8221;, &#8220;\u5341\u4e09&#8221;, &#8220;\u5341\u56db&#8221;, &#8220;\u5341\u4e94&#8221;, &#8220;\u5341\u516d&#8221;, &#8220;\u5341\u4e03&#8221;, &#8220;\u5341\u516b&#8221;, &#8220;\u5341\u4e5d&#8221;, &#8220;\u4e8c\u5341&#8221;,<br \/>\n&#8220;\u5eff\u4e00&#8221;, &#8220;\u5eff\u4e8c&#8221;, &#8220;\u5eff\u4e09&#8221;, &#8220;\u5eff\u56db&#8221;, &#8220;\u5eff\u4e94&#8221;, &#8220;\u5eff\u516d&#8221;, &#8220;\u5eff\u4e03&#8221;, &#8220;\u5eff\u516b&#8221;, &#8220;\u5eff\u4e5d&#8221;, &#8220;\u4e09\u5341&#8221;];<\/p>\n<p>\/\/ \u8fd9\u91cc\u4f7f\u7528\u7b80\u5316\u7b97\u6cd5\uff0c\u5b9e\u9645\u5e94\u7528\u4e2d\u5e94\u4f7f\u7528\u66f4\u7cbe\u786e\u7684\u519c\u5386\u8ba1\u7b97\u5e93<br \/>\nconst month = lunarMonths[today.getMonth() % 12];<br \/>\nconst day = lunarDays[today.getDate() % 30];<\/p>\n<p>document.getElementById(&#8216;lunarDate&#8217;).innerText = month + day;<br \/>\n}<\/p>\n<p>function getWeatherData() {<br \/>\n\/\/ \u4f7f\u7528OpenWeatherMap API\u83b7\u53d6\u4e0a\u6d77\u5929\u6c14\uff08\u9700\u8981\u6ce8\u518c\u83b7\u53d6API\u5bc6\u94a5\uff09<br \/>\n\/\/ \u8fd9\u91cc\u4f7f\u7528\u6a21\u62df\u6570\u636e\uff0c\u5b9e\u9645\u4f7f\u7528\u65f6\u8bf7\u66ff\u6362\u4e3a\u771f\u5b9e\u7684API\u8c03\u7528<br \/>\nconst apiKey = &#8216;YOUR_API_KEY&#8217;; \/\/ \u66ff\u6362\u4e3a\u4f60\u7684API\u5bc6\u94a5<br \/>\nconst city = &#8216;Shanghai&#8217;;<br \/>\nconst apiUrl = `https:\/\/api.openweathermap.org\/data\/2.5\/weather?q=${city}&amp;appid=${apiKey}&amp;units=metric&amp;lang=zh_cn`;<\/p>\n<p>\/\/ \u6a21\u62df\u6570\u636e\uff08\u5b9e\u9645\u4f7f\u7528\u65f6\u8bf7\u5220\u9664\u8fd9\u90e8\u5206\uff0c\u4f7f\u7528\u4e0a\u9762\u7684API\u8c03\u7528\uff09<br \/>\nconst mockWeatherData = {<br \/>\nmain: { temp: 22 },<br \/>\nweather: [{ description: &#8216;\u591a\u4e91&#8217;, icon: &#8217;03d&#8217; }]<br \/>\n};<\/p>\n<p>\/\/ \u4f7f\u7528\u6a21\u62df\u6570\u636e<br \/>\ndocument.getElementById(&#8216;weatherTemp&#8217;).innerText = mockWeatherData.main.temp + &#8220;\u00b0C&#8221;;<br \/>\ndocument.getElementById(&#8216;weatherDesc&#8217;).innerText = mockWeatherData.weather[0].description;<\/p>\n<p>\/\/ \u6839\u636e\u5929\u6c14\u63cf\u8ff0\u8bbe\u7f6e\u56fe\u6807<br \/>\nconst weatherDesc = mockWeatherData.weather[0].description;<br \/>\nlet weatherIcon = &#8216;\ud83c\udf24\ufe0f&#8217;; \/\/ \u9ed8\u8ba4\u56fe\u6807<\/p>\n<p>if (weatherDesc.includes(&#8216;\u6674&#8217;)) weatherIcon = &#8216;\u2600\ufe0f&#8217;;<br \/>\nelse if (weatherDesc.includes(&#8216;\u4e91&#8217;)) weatherIcon = &#8216;\u2601\ufe0f&#8217;;<br \/>\nelse if (weatherDesc.includes(&#8216;\u96e8&#8217;)) weatherIcon = &#8216;\ud83c\udf27\ufe0f&#8217;;<br \/>\nelse if (weatherDesc.includes(&#8216;\u96ea&#8217;)) weatherIcon = &#8216;\u2744\ufe0f&#8217;;<br \/>\nelse if (weatherDesc.includes(&#8216;\u96fe&#8217;) || weatherDesc.includes(&#8216;\u973e&#8217;)) weatherIcon = &#8216;\ud83c\udf2b\ufe0f&#8217;;<\/p>\n<p>document.getElementById(&#8216;weatherIcon&#8217;).innerText = weatherIcon;<\/p>\n<p>\/* \u5b9e\u9645API\u8c03\u7528\u4ee3\u7801\uff08\u53d6\u6d88\u6ce8\u91ca\u5e76\u66ff\u6362API\u5bc6\u94a5\uff09<br \/>\nfetch(apiUrl)<br \/>\n.then(response =&gt; response.json())<br \/>\n.then(data =&gt; {<br \/>\ndocument.getElementById(&#8216;weatherTemp&#8217;).innerText = data.main.temp + &#8220;\u00b0C&#8221;;<br \/>\ndocument.getElementById(&#8216;weatherDesc&#8217;).innerText = data.weather[0].description;<\/p>\n<p>\/\/ \u6839\u636e\u5929\u6c14\u56fe\u6807\u4ee3\u7801\u8bbe\u7f6e\u8868\u60c5\u56fe\u6807<br \/>\nconst iconCode = data.weather[0].icon;<br \/>\nlet weatherIcon = &#8216;\ud83c\udf24\ufe0f&#8217;; \/\/ \u9ed8\u8ba4\u56fe\u6807<\/p>\n<p>if (iconCode.includes(&#8217;01&#8217;)) weatherIcon = &#8216;\u2600\ufe0f&#8217;; \/\/ \u6674\u5929<br \/>\nelse if (iconCode.includes(&#8217;02&#8217;)) weatherIcon = &#8216;\u26c5&#8217;; \/\/ \u5c11\u4e91<br \/>\nelse if (iconCode.includes(&#8217;03&#8217;) || iconCode.includes(&#8217;04&#8217;)) weatherIcon = &#8216;\u2601\ufe0f&#8217;; \/\/ \u591a\u4e91<br \/>\nelse if (iconCode.includes(&#8217;09&#8217;)) weatherIcon = &#8216;\ud83c\udf27\ufe0f&#8217;; \/\/ \u9635\u96e8<br \/>\nelse if (iconCode.includes(&#8217;10&#8217;)) weatherIcon = &#8216;\ud83c\udf26\ufe0f&#8217;; \/\/ \u96e8<br \/>\nelse if (iconCode.includes(&#8217;11&#8217;)) weatherIcon = &#8216;\u26c8\ufe0f&#8217;; \/\/ \u96f7\u96e8<br \/>\nelse if (iconCode.includes(&#8217;13&#8217;)) weatherIcon = &#8216;\u2744\ufe0f&#8217;; \/\/ \u96ea<br \/>\nelse if (iconCode.includes(&#8217;50&#8217;)) weatherIcon = &#8216;\ud83c\udf2b\ufe0f&#8217;; \/\/ \u96fe<\/p>\n<p>document.getElementById(&#8216;weatherIcon&#8217;).innerText = weatherIcon;<br \/>\n})<br \/>\n.catch(error =&gt; {<br \/>\nconsole.error(&#8216;\u83b7\u53d6\u5929\u6c14\u6570\u636e\u5931\u8d25:&#8217;, error);<br \/>\ndocument.getElementById(&#8216;weatherTemp&#8217;).innerText = &#8216;&#8211;\u00b0C&#8217;;<br \/>\ndocument.getElementById(&#8216;weatherDesc&#8217;).innerText = &#8216;\u83b7\u53d6\u5931\u8d25&#8217;;<br \/>\n});<br \/>\n*\/<br \/>\n}<\/p>\n<p>\/\/ \u521d\u59cb\u5316<br \/>\ncalculateTimeRemaining();<br \/>\ngetLunarDate();<br \/>\ngetWeatherData();<\/p>\n<p>\/\/ \u6bcf\u5206\u949f\u66f4\u65b0\u4e00\u6b21\u6570\u636e<br \/>\nsetInterval(function() {<br \/>\ncalculateTimeRemaining();<br \/>\ngetLunarDate();<br \/>\ngetWeatherData();<br \/>\n}, 60000);<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/div&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;div class=&#8221;stats-widget&#8221;&gt; &lt;style&gt; .stats-widget { font-family: Arial, sans-serif; background: #&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[136],"tags":[309,404,477],"topic":[342],"class_list":["post-653263","post","type-post","status-publish","format-standard","hentry","category-136","tag-html","tag-wordpress","tag-477","topic-wordpress"],"_links":{"self":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/653263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=653263"}],"version-history":[{"count":1,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/653263\/revisions"}],"predecessor-version":[{"id":653266,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/653263\/revisions\/653266"}],"wp:attachment":[{"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=653263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=653263"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=653263"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=653263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}