<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress &#8211; 老丁的博客</title>
	<atom:link href="https://www.laoding.me/archives/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>https://www.laoding.me</link>
	<description></description>
	<lastBuildDate>Wed, 16 Oct 2024 04:15:14 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://public-123.oss-cn-guangzhou.aliyuncs.com/2024/09/cropped-图片_20240927133356-768x768-1-32x32.jpg</url>
	<title>WordPress &#8211; 老丁的博客</title>
	<link>https://www.laoding.me</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>如何翻译WordPress插件</title>
		<link>https://www.laoding.me/archives/711</link>
					<comments>https://www.laoding.me/archives/711#respond</comments>
		
		<dc:creator><![CDATA[laoding]]></dc:creator>
		<pubDate>Wed, 09 Oct 2024 10:25:46 +0000</pubDate>
				<category><![CDATA[办公网络]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.laoding.me/?p=711</guid>

					<description><![CDATA[1.检查插件配置文件是否加载语言翻译文件及路径（以simple-location插件为便） # 插件配置文件位 [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>1.检查插件配置文件是否加载语言翻译文件及路径（以simple-location插件为便）</h3>
<pre class="code"># 插件配置文件位置
index/wp-content/plugins/simple-location/simple-location.php

# 加载翻译文件的代码
add_action( 'plugins_loaded', function() {
load_plugin_textdomain( 'simple-location', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
});</pre>
<h3>2.制作po文件</h3>
<pre class="code">msgid "Hello"
msgstr "你好"

msgid "Goodbye"
msgstr "再见"
</pre>
<h3>3.将po文件转换成二进制的mo文件，WordPress主要识别mo文件进行翻译显示</h3>
<p>可以用Ubuntu的msgfmt工具进行转换，用msgfmt可以对mo和po文件进行互相转换</p>
<pre class="code">msgfmt -o simple-location-zh_CN.mo simple-location-zh_CN.po</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.laoding.me/archives/711/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress程序修改集锦</title>
		<link>https://www.laoding.me/archives/226</link>
					<comments>https://www.laoding.me/archives/226#comments</comments>
		
		<dc:creator><![CDATA[laoding]]></dc:creator>
		<pubDate>Sat, 28 Sep 2024 10:12:40 +0000</pubDate>
				<category><![CDATA[办公网络]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://laoding.me/?p=226</guid>

					<description><![CDATA[1.修改代码高亮的图标 文件位置：wp-content/themes/argon/argontheme.js  [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>1.修改代码高亮的图标</h2>
<ul>
<li>文件位置：<code>wp-content/themes/argon/argontheme.js</code></li>
<li>代码位置2476行：</li>
</ul>
<pre class="code"> &lt;i class="fa fa-copy"&gt;&lt;/i&gt;</pre>
<h2>2.全屏背景</h2>
<ul>
<li>相关文件：index/wp-content/themes/argon/header.php（405）和index/wp-content/themes/argon/style.css（4714）</li>
<li>注释代码：</li>
</ul>
<pre class="code"> &lt;?php /* echo get_option('argon_banner_background_color_type') == '' ? 'shape-primary' : get_option('argon_banner_background_color_type'); */ ?&gt;</pre>
<pre class="code">/* html.darkmode .banner {
background-color: var(--color-darkmode-banner);
} */</pre>
<h2>3.修改Argon主题中右侧边栏评价列表对齐</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/style.css（5240）</li>
</ul>
<pre class="code"> /*自定义样式*/
.wp-block-latest-comments{ padding-inline-start: 0px!important;}</pre>
<h2>4.修改Argon主题中右侧边栏搜索框</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/style.css（5240）</li>
</ul>
<pre class="code">.wp-block-search__input{
border-radius: 4px;
border: 1px solid #adb5bd;
}
.wp-block-search__button{border-radius: 3px;}</pre>
<h2>5.在文章中添加返回按钮</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/template-parts/share.php</li>
<li>添加代码：</li>
</ul>
<pre class="code">&lt;a target="_blank" class="no-pjax icon-copy-link" id="share_copy_back" tooltip="&lt;?php _e('返回', 'argon'); ?&gt;"&gt;
   &lt;button class="btn btn-icon btn-default"&gt;
      &lt;span class="btn-inner--icon"&gt;&lt;i class="fa fa-reply"&gt;&lt;/i&gt;&lt;/span&gt;
   &lt;/button&gt;
&lt;/a&gt;
……
&lt;button id="back_button" class="btn btn-icon btn-primary" tooltip="返回上一页"&gt;
&lt;span class="btn-inner--icon"&gt;&lt;i class="fa fa-reply"&gt;&lt;/i&gt;&lt;/span&gt;
&lt;/button&gt;</pre>
<pre class="code">&lt;script type="text/javascript"&gt;
// 添加点击事件监听器
document.getElementById('back_button').onclick = function() {
window.history.back(); // 返回上一页
};
&lt;/script&gt;</pre>
<ul>
<li>添加css样式</li>
</ul>
<pre class="code">/*文章下面的返回按钮*/
#back_button {
position: absolute;
right: 60px;
top: 0;
opacity: 1;
}
#share_container.opened #back_button {
top: -50px;
opacity: 0;
pointer-events: none;
}
#back_button:before {
pointer-events: none;
position: absolute;
top: -50px;
right: 0px;
line-height: 25px;
width: max-content;
width: -moz-max-content;
text-align: center;
font-weight: normal;
color: #fff;
background: #32325d;
padding: 3px 10px;
font-size: 14px;
border-radius: 3px;
z-index: 3;
transition: all 0.3s ease;
transform: translateY(5px);
opacity: 0;
}
#back_button:hover:before {
transform: translateY(0);
opacity: 0.7;
}
#back_button:before {
content: attr(tooltip);
top: -40px;
height: max-content;
height: -moz-max-content;
text-transform: none;
}</pre>
<ul>
<li>添加隐藏分享按钮的js：</li>
</ul>
<pre class="code">$("#share_copy_back")[0].onclick = function() {
$("#share_container").removeClass("opened");
};</pre>
<h2>6.把边栏悬浮菜单的向左更换为返回</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/header.php（）</li>
</ul>
<pre class="code">&lt;button id="fabtn_toggle_sides" class="btn btn-icon btn-neutral fabtn shadow-sm" type="button" aria-hidden="true" tooltip-move-to-left="&lt;?php _e('移至左侧', 'argon'); ?&gt;" tooltip-move-to-right="&lt;?php _e('移至右侧', 'argon'); ?&gt;"&gt;
&lt;span class="btn-inner--icon fabtn-show-on-right"&gt;&lt;i class="fa fa-caret-left"&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span class="btn-inner--icon fabtn-show-on-left"&gt;&lt;i class="fa fa-caret-right"&gt;&lt;/i&gt;&lt;/span&gt;
&lt;/button&gt;</pre>
<p>改为：</p>
<pre class="code">&lt;button id="fabtn_toggle_sides" class="btn btn-icon btn-neutral fabtn shadow-sm" type="button" aria-hidden="true" tooltip-move-to-left="&lt;?php _e('返回', 'argon'); ?&gt;" tooltip-move-to-right="&lt;?php _e('返回', 'argon'); ?&gt;"&gt;
&lt;span class="btn-inner--icon fabtn-show-on-right"&gt;&lt;i class="fa fa-reply"&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span class="btn-inner--icon fabtn-show-on-left"&gt;&lt;i class="fa fa-caret-right"&gt;&lt;/i&gt;&lt;/span&gt;
&lt;/button&gt;</pre>
<ul>
<li>修改文件：index/wp-content/themes/argon/argontheme.js（566）</li>
</ul>
<pre class="code">/*
$toggleSidesBtn.on("click" , function(){
$fabtns.addClass("fabtns-unloaded");
setTimeout(function(){
$fabtns.toggleClass("fabtns-float-left");
if ($fabtns.hasClass("fabtns-float-left")){
localStorage['Argon_fabs_Floating_Status'] = "left";
}else{
localStorage['Argon_fabs_Floating_Status'] = "right";
}
$fabtns.removeClass("fabtns-unloaded");
} , 300);
});
*/
$toggleSidesBtn.on("click" , function(){
window.history.back(); // 返回上一页
});</pre>
<h2>7.添加博客网龄</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/argontheme.js</li>
<li>添加代码：</li>
</ul>
<pre class="code"> 
function calculateTime() {
	// 设置博客上线日期
	var launchDate = new Date("2017-09-19");

	// 获取当前日期和时间
	var now = new Date();

	// 计算时间差（以毫秒为单位）
	var timeDiff = now - launchDate;

	// 计算年数
	var yearsRunning = now.getFullYear() - launchDate.getFullYear();

	// 计算天数（考虑年份的影响）
	var daysRunning = Math.floor(timeDiff / (1000 * 60 * 60 * 24)) % 365;

	// 计算小时数
	var hoursRunning = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));

	// 计算分钟数
	var minutesRunning = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));

	// 计算秒数
	var secondsRunning = Math.floor((timeDiff % (1000 * 60)) / 1000);

	// 显示结果
	document.getElementById("time").innerHTML = "老丁博客的网龄： " + yearsRunning + " 年 " + daysRunning + " 天 " + hoursRunning + " 时 " + minutesRunning + " 分 " + secondsRunning + " 秒";
};

// 页面加载时运行
window.onload = function() {
	calculateTime();
	// 每秒自动更新一次
	setInterval(calculateTime, 1000); // 1000 毫秒 = 1秒
};</pre>
<ul>
<li>修改文件：index/wp-content/themes/argon/footer.php（5）</li>
<li>添加代码：</li>
</ul>
<pre class="code">&lt;div&gt;&lt;span id="time"&gt;&lt;/span&gt;&lt;/div&gt;</pre>
<h2>8.增加农历和节气</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/functions.php</li>
<li>增加代码：<a href="https://www.laoding.me/wp-content/uploads/2024/09/农历代码.txt">农历代码</a></li>
<li>修改文件：index/wp-content/themes/argon/header.php（421）</li>
<li>修改代码</li>
</ul>
<p>&nbsp;</p>
<pre class="code">&lt;div id="banner_container" class="banner-container container text-center"&gt;
&lt;?php if ($enable_banner_title_typing_effect != "true"){?&gt;
&lt;div class="banner-title text-white" style="text-align: right;"&gt;&lt;span class="banner-title-inner"&gt;&lt;!--&lt;?php echo apply_filters('argon_banner_title_html', $banner_title); ?&gt;--&gt;&lt;?php echo get_lunar_date(); ?&gt;&lt;/span&gt;
&lt;!--&lt;?php echo get_option('argon_banner_subtitle') == '' ? '' : '&lt;span class="banner-subtitle d-block"&gt;' . get_option('argon_banner_subtitle') . '&lt;/span&gt;'; ?&gt;--&gt;
&lt;span class="banner-subtitle d-block"&gt;&lt;?php echo get_jieqi_info(); ?&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;?php } else {?&gt;
&lt;div class="banner-title text-white" data-interval="&lt;?php echo get_option('argon_banner_typing_effect_interval', 100); ?&gt;"&gt;&lt;span data-text="&lt;?php echo $banner_title; ?&gt;" class="banner-title-inner"&gt;&amp;nbsp;&lt;/span&gt;
&lt;?php echo get_option('argon_banner_subtitle') == '' ? '' : '&lt;span data-text="' . get_option('argon_banner_subtitle') . '" class="banner-subtitle d-block"&gt;&amp;nbsp;&lt;/span&gt;'; ?&gt;&lt;?php echo get_jieqi_info(); ?&gt;&lt;/div&gt;
&lt;?php }?&gt;
&lt;/div&gt;</pre>
<h2>9.取消文章页页头背景</h2>
<ul>
<li>修改文件：index/wp-content/themes/argon/template-parts/content-single.php</li>
<li>修改代码：</li>
</ul>
<pre class="code">('argon_show_thumbnail_in_banner_in_content_page') != 'true')</pre>
<p>修改为：</p>
<pre class="code"> ('argon_show_thumbnail_in_banner_in_content_page') == 'true')</pre>
<p>注释代码：</p>
<pre class="code">&lt;?php
/*
if (argon_has_post_thumbnail() &amp;&amp; get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
$thumbnail_url = argon_get_post_thumbnail();
echo "&lt;img class='post-thumbnail' src='" . $thumbnail_url . "'&gt;&lt;/img&gt;";
echo "&lt;div class='post-header-text-container'&gt;";
}
if (argon_has_post_thumbnail() &amp;&amp; get_option('argon_show_thumbnail_in_banner_in_content_page') == 'true'){
$thumbnail_url = argon_get_post_thumbnail();
echo "
&lt;style&gt;
body section.banner {
background-image: url(" . $thumbnail_url . ") !important;
}
&lt;/style&gt;";
}
*/
?&gt;</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.laoding.me/archives/226/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
