{"id":165,"date":"2026-01-31T14:31:34","date_gmt":"2026-01-31T06:31:34","guid":{"rendered":"http:\/\/47.100.165.17\/wordpress\/?p=165"},"modified":"2026-01-31T14:31:34","modified_gmt":"2026-01-31T06:31:34","slug":"%e3%80%90%e7%bd%91%e7%ab%99%e5%bb%ba%e8%ae%be%e3%80%91wordpress-%e9%a1%b5%e8%84%9a%e6%b7%bb%e5%8a%a0%e7%ab%99%e7%82%b9%e8%bf%90%e8%a1%8c%e6%97%b6%e9%95%bf","status":"publish","type":"post","link":"https:\/\/yunyanglib.cn\/?p=165","title":{"rendered":"\u3010\u7f51\u7ad9\u5efa\u8bbe\u3011WordPress \u9875\u811a\u6dfb\u52a0\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6b63\u5982\u6807\u9898\u6240\u793a\uff0c\u5728 WordPress \u535a\u5ba2\u7684\u9875\u811a\u6dfb\u52a0 \u7ad9\u70b9\u5df2\u8fd0\u884c\u65f6\u957f\uff08\u7cbe\u786e\u5230\u79d2\uff0c\u683c\u5f0f\u4e3a\u300c\u5e74 \u6708 \u65e5 \u65f6 \u5206 \u79d2\u300d\uff09\u7684\u529f\u80fd\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u521b\u5efa\u5e76\u542f\u7528\u5b50\u4e3b\u9898\uff08\u82e5\u5df2\u542f\u7528\uff0c\u76f4\u63a5\u8df3\u8fc7\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"461\" src=\"http:\/\/47.100.165.17\/wordpress\/wp-content\/uploads\/2026\/01\/image-7-1024x461.png\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/yunyanglib.cn\/wp-content\/uploads\/2026\/01\/image-7-1024x461.png 1024w, https:\/\/yunyanglib.cn\/wp-content\/uploads\/2026\/01\/image-7-300x135.png 300w, https:\/\/yunyanglib.cn\/wp-content\/uploads\/2026\/01\/image-7-768x346.png 768w, https:\/\/yunyanglib.cn\/wp-content\/uploads\/2026\/01\/image-7-1536x691.png 1536w, https:\/\/yunyanglib.cn\/wp-content\/uploads\/2026\/01\/image-7.png 1893w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u5728\u5b50\u4e3b\u9898 <code>footer.php<\/code> \u4e2d\u6dfb\u52a0\u4ee3\u7801<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script>\n\/\/ ******** \u5173\u952e\u914d\u7f6e\uff1a\u4fee\u6539\u4e3a\u4f60\u7684\u535a\u5ba2\u5b9e\u9645\u5efa\u7ad9\u65e5\u671f ********\nconst SITE_START_DATE = new Date('2020-01-01 10:30:00'); \/\/ \u683c\u5f0f\uff1aYYYY-MM-DD HH:MM:SS\n\n\/\/ \u65f6\u95f4\u5dee\u8ba1\u7b97\u51fd\u6570\uff08\u4f18\u5316\u7248\uff0c\u8003\u8651\u6708\u4efd\u5929\u6570\u5dee\u5f02\uff09\nfunction calculateTimeDifference(startDate, endDate) {\n  let years = endDate.getFullYear() - startDate.getFullYear();\n  let months = endDate.getMonth() - startDate.getMonth();\n  let days = endDate.getDate() - startDate.getDate();\n  let hours = endDate.getHours() - startDate.getHours();\n  let minutes = endDate.getMinutes() - startDate.getMinutes();\n  let seconds = endDate.getSeconds() - startDate.getSeconds();\n\n  \/\/ \u5904\u7406\u8d1f\u6570\u60c5\u51b5\uff08\u65f6\u95f4\u501f\u4f4d\uff09\n  if (seconds &lt; 0) {\n    seconds += 60;\n    minutes--;\n  }\n  if (minutes &lt; 0) {\n    minutes += 60;\n    hours--;\n  }\n  if (hours &lt; 0) {\n    hours += 24;\n    days--;\n  }\n  if (days &lt; 0) {\n    \/\/ \u83b7\u53d6\u4e0a\u6708\u5929\u6570\n    const lastMonth = new Date(endDate.getFullYear(), endDate.getMonth(), 0);\n    days += lastMonth.getDate();\n    months--;\n  }\n  if (months &lt; 0) {\n    months += 12;\n    years--;\n  }\n\n  return { years, months, days, hours, minutes, seconds };\n}\n\n\/\/ \u66f4\u65b0\u663e\u793a\u51fd\u6570\nfunction updateSiteAge() {\n  const now = new Date();\n  const timeDiff = calculateTimeDifference(SITE_START_DATE, now);\n  \n  \/\/ \u66f4\u65b0\u9875\u9762\u5143\u7d20\n  document.getElementById('site-age-years').textContent = timeDiff.years;\n  document.getElementById('site-age-months').textContent = timeDiff.months;\n  document.getElementById('site-age-days').textContent = timeDiff.days;\n  document.getElementById('site-age-hours').textContent = timeDiff.hours;\n  document.getElementById('site-age-minutes').textContent = timeDiff.minutes;\n  document.getElementById('site-age-seconds').textContent = timeDiff.seconds;\n}\n\n\/\/ \u521d\u59cb\u5316\u663e\u793a\u5e76\u6bcf\u79d2\u5237\u65b0\nupdateSiteAge();\nsetInterval(updateSiteAge, 1000); \/\/ 1\u79d2\u5237\u65b0\u4e00\u6b21\uff0c\u6027\u80fd\u65e0\u5f71\u54cd\n&lt;\/script><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u4fee\u6539\u5b50\u4e3b\u9898\u4e2dclass_footer.php\u4ee3\u7801<\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u627e\u5230\u9700\u8981\u63d2\u5165\u7684\u4f4d\u7f6e\uff08\u5173\u952e\u884c\uff09<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>$html .= '&lt;\/div>';  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. \u63d2\u5165\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f\u7684 PHP \u62fc\u63a5\u4ee3\u7801<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728<code> $html .= '&lt;\/div>'; <\/code>\u540e\u9762\uff0c\u65b0\u589e\u4e00\u884c\u4ee3\u7801\uff08\u76f4\u63a5\u590d\u5236\u7c98\u8d34\u5373\u53ef\uff0c\u65e0\u9700\u4fee\u6539\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u62fc\u63a5\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f\u7684HTML\u5bb9\u5668\uff08\u7ed9JS\u63d0\u4f9bDOM\u5143\u7d20\uff0c\u6837\u5f0f\u5df2\u4f18\u5316\u95f4\u8ddd\uff09\n$html .= '&lt;div id=\"site-age-container\" style=\"text-align: center; margin: 5px 0; color: #666; font-size: 14px;\">\u5df2\u8fd0\u884c &lt;span id=\"site-age-years\">0&lt;\/span> \u5e74 &lt;span id=\"site-age-months\">0&lt;\/span> \u6708 &lt;span id=\"site-age-days\">0&lt;\/span> \u5929 &lt;span id=\"site-age-hours\">0&lt;\/span> \u5c0f\u65f6 &lt;span id=\"site-age-minutes\">0&lt;\/span> \u5206 &lt;span id=\"site-age-seconds\">0&lt;\/span> \u79d2&lt;\/div>';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. \u4fee\u6539\u540e\u7684\u5b8c\u6574\u51fd\u6570\u4ee3\u7801\uff08\u6807\u6ce8\u65b0\u589e\u90e8\u5206\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u662f\u4fee\u6539\u540e\u7684\u5b8c\u6574\u51fd\u6570\uff0c\u65b0\u589e\u90e8\u5206\u5df2\u6807\u6ce8\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public function site_footer_info (){\n    $text ='';\n    $html = '&lt;div class=\"site_info\">&lt;div class=\"container text-center\">';\n\n    $html .= $this->site_footer_back_top();\n\n    $html .= '&lt;div class=\"text\">';\n\n    if( get_theme_mod('copyright_text') != '' )\n    {\n            $text .= esc_html(  get_theme_mod('copyright_text') );\n    }else\n    {\n            \/* translators: 1: Current Year, 2: Blog Name  *\/\n            $text .= sprintf( esc_html__( 'Copyright &amp;copy; %1$s %2$s. All Right Reserved.', 'personal-cv-resume' ), date_i18n( _x( 'Y', 'copyright date format', 'personal-cv-resume' ) ), esc_html( get_bloginfo( 'name' ) ) );\n\n    }\n\n    $html  .= apply_filters( 'emart_footer_copywrite_filter', $text );\n\n    \/* translators: 1: developer website, 2: WordPress url  *\/\n    $html  .= '&lt;span class=\"dev_info\">'.sprintf( esc_html__( 'Theme : %1$s By %2$s', 'personal-cv-resume' ), '&lt;a href=\"'. esc_url( 'https:\/\/wordpress.org\/themes\/personal-cv-resume\/' ) .'\" target=\"_blank\" rel=\"nofollow\">'.esc_html_x( 'Personal CV Resume', 'theme name', 'personal-cv-resume' ).'&lt;\/a>',  '&lt;a href=\"'.esc_url( __( 'https:\/\/athemeart.com\/', 'personal-cv-resume' ) ).'\" target=\"_blank\" rel=\"nofollow\">'.esc_html_x( 'aThemeArt', 'credit to developer', 'personal-cv-resume' ).'&lt;\/a>' ).'&lt;\/span>';\n\n    $html .= '&lt;\/div>';\n\n    \/\/ ========== \u65b0\u589e\uff1a\u62fc\u63a5\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f\u7684HTML\u5bb9\u5668\uff08\u5173\u952e\u884c\uff09 ==========\n    $html .= '&lt;div id=\"site-age-container\" style=\"text-align: center; margin: 5px 0; color: #666; font-size: 14px;\">\u5df2\u8fd0\u884c &lt;span id=\"site-age-years\">0&lt;\/span> \u5e74 &lt;span id=\"site-age-months\">0&lt;\/span> \u6708 &lt;span id=\"site-age-days\">0&lt;\/span> \u5929 &lt;span id=\"site-age-hours\">0&lt;\/span> \u5c0f\u65f6 &lt;span id=\"site-age-minutes\">0&lt;\/span> \u5206 &lt;span id=\"site-age-seconds\">0&lt;\/span> \u79d2&lt;\/div>';\n\n    $html .= '&lt;\/div>&lt;\/div>';\n\n    echo wp_kses( $html, $this->alowed_tags() );\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u9a8c\u8bc1\u6548\u679c\uff08\u6700\u540e\u4e00\u6b65\uff09<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fdd\u5b58 <code>class\/class_footer.php<\/code> \u548c <code>footer.php<\/code> \u6587\u4ef6\u3002 \u5237\u65b0\u535a\u5ba2\u524d\u53f0\uff0c\u6eda\u52a8\u5230\u9875\u811a\uff0c\u5373\u53ef\u770b\u5230\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7248\u6743\u4fe1\u606f\u548c\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f\u7d27\u5bc6\u8d34\u5408\uff0c\u65e0\u8fc7\u5927\u95f4\u8ddd\u3002<\/li>\n\n\n\n<li>\u7ad9\u70b9\u8fd0\u884c\u65f6\u957f\u7684\u79d2\u6570\u4f1a\u5b9e\u65f6\u8df3\u52a8\u66f4\u65b0\uff0c\u529f\u80fd\u6b63\u5e38\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/47.100.165.17\/wordpress\/wp-content\/uploads\/2026\/01\/image-8-1024x477.png\" alt=\"\" class=\"wp-image-167\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5982\u6807\u9898\u6240\u793a\uff0c\u5728 WordPress \u535a\u5ba2\u7684\u9875\u811a\u6dfb\u52a0 \u7ad9\u70b9\u5df2\u8fd0\u884c\u65f6\u957f\uff08\u7cbe\u786e\u5230\u79d2\uff0c\u683c\u5f0f\u4e3a\u300c\u5e74 \u6708 \u65e5 \u65f6 \u5206 \u79d2<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"https:\/\/yunyanglib.cn\/?p=165\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":1,"featured_media":168,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[13],"class_list":["post-165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-construction","tag-web-devement"],"_links":{"self":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165"}],"version-history":[{"count":1,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":169,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions\/169"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/media\/168"}],"wp:attachment":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}