<?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.3code.cn/wordpress%e6%95%99%e7%a8%8b/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.3code.cn</link>
	<description>Wordpress外贸企业主题, Wp企业主题, wordpress企业主题, wordpress主题定制, WORDPRESS外贸网站建设SEO</description>
	<lastBuildDate>Fri, 27 Dec 2024 06:36:52 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>了解 WordPress 文件系统权限: aws bitnami</title>
		<link>https://www.3code.cn/wordpress-aws-bitnami/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 27 Dec 2024 06:35:43 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=4100</guid>

					<description><![CDATA[Bitnami 对 WordPress 文件和目录应用以下​​默认权限： 文件和目录归用户bitna<a class="moretag" href="https://www.3code.cn/wordpress-aws-bitnami/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><span>Bitnami 对 WordPress 文件和目录应用以下​​默认权限：</span></p>
<ul>
<li><span>文件和目录归用户</span><em><span>bitnami</span></em><span>和组</span><em><span>daemon</span></em><span>所有。</span></li>
<li><span>目录默认配置有权限</span><em><span>775</span></em><span>。</span></li>
<li><span>文件默认配置有权限</span><em><span>664</span></em><span>。</span></li>
<li><span></span><em><span>wp-config.php</span></em><span>文件配置了权限</span><em><span>640</span></em><span>。</span></li>
</ul>
<p><span>如果权限错误，请使用</span><em><span>chmod</span></em><span>或</span><em><span>chown</span></em><span>命令将其恢复到初始状态。例如，对wp-content目录设置权限：</span></p>
<pre>sudo chown -R bitnami:daemon /bitnami/wordpress/wp-content
sudo find /bitnami/wordpress/wp-content -type d -exec chmod 775 {} \;
sudo find /bitnami/wordpress/wp-content -type f -exec chmod 664 {} \;
sudo chmod 640 /bitnami/wordpress/wp-config.php
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress数据库太大超1G了，搬家的话如何导入，宝塔面板大数据库导入</title>
		<link>https://www.3code.cn/wordpress-big-sql-import/</link>
					<comments>https://www.3code.cn/wordpress-big-sql-import/#comments</comments>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Mon, 31 May 2021 13:41:51 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress数据库导入]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3982</guid>

					<description><![CDATA[WordPress大数据库搬家，导入数据库是一件非常头痛的事，因为通过phpmyadmin导入这么大<a class="moretag" href="https://www.3code.cn/wordpress-big-sql-import/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>WordPress大数据库搬家，导入数据库是一件非常头痛的事，因为通过phpmyadmin导入这么大的数据库一定会卡机，一直无响应，如果你用的是服务器的话cpu与内存会100%用完的，就卡那里了。如果是用的虚拟主机，想就不用想，不可能完成的。</p>
<h2>WordPress大数据库导入（搬家）有没有可行的办法？</h2>
<ol>
<li>如果数据库不算太大，勉强可以用Phpmyadmin导入。</li>
<li>如果数据库超大，有人说可以将数据库分割，然后一点点的导入（想想都头大）。</li>
<li>最适合的方法是下面的这种，直接通过mysql命令导入（仅限服务器，虚拟机除外）。</li>
</ol>
<p>&#8211;</p>
<h2>WordPress大数据库导入操作步骤</h2>
<p>1. 先将sql文件上传到服务器,例如上传到www文件夹</p>
<p>2. 然后打开命令行工具输入: mysql -u 数据库用户名 -p</p>
<p>3. 然后复制密码进去</p>
<p>4. 然后输入: use 数据库名, 按回车</p>
<p>5. 然后输入：source /www/xxx.sql（注：xxx.sql就是你已经上传到服务器上的sql文件）</p>
<p>6. 耐心等待，如果数据库超大，多等一会。</p>
<p>7. 一般小的数据库1分钟左右，大的（1G）10分钟左右，再大没试过。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.3code.cn/wordpress-big-sql-import/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>163免费企业邮箱域名邮箱申请使用详细教程</title>
		<link>https://www.3code.cn/163-free-email/</link>
					<comments>https://www.3code.cn/163-free-email/#comments</comments>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 23 Aug 2019 08:59:09 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3877</guid>

					<description><![CDATA[163免费企业邮箱，又称域名邮箱，就是以你的域名为结尾的邮箱，申请使用详细教程 &#160; 首先登<a class="moretag" href="https://www.3code.cn/163-free-email/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<h2>163免费企业邮箱，又称域名邮箱，就是以你的域名为结尾的邮箱，申请使用详细教程</h2>
<p>&nbsp;<br />
首先登陆网址：http://ym.163.com/ ，点击“免费创建”按钮，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-1.jpg"></p>
<p>第一步，设置域名（提示：输入的域名切记不要带www.），如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-2.jpg"></p>
<p>第二步，设置邮箱管理员（提示：这里设置的管理员姓名必须是您身份证上真实的姓名，后面要进行实名认证的！管理账号和密码是用于管理企业邮箱的，务必牢记），安全信息中需填写真实有效的手机号（用于接收网易企业邮箱发送的短信提醒信息）和常用的真实有效的个人密保邮箱（用于接收网易企业邮箱发送的一些重要通知等信息），如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-3.jpg"></p>
<p>第三步，验证手机号（主要目的是验证该手机号码是否真实有效），如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-4.jpg"></p>
<p>第四步，验证MX记录（提示：该步骤需要联系我们的工作人员来完成），如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-5.jpg"></p>
<p>第五步，创建完成，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-6.jpg"></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>管理账号创建完毕以后，下面开始演示如何通过管理账号登录网易企业邮箱：</p>
<p>首先登陆网址：http://ym.163.com/，点击“登录”按钮，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-7.jpg"></p>
<p>第一步，输入管理账号和密码（提示：先把标签切换到管理员登录，然后输入管理账号和密码，这里的管理账号是个邮箱地址就是上面“第二步”创建好的），点击“管理员登录”按钮，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-8.jpg"></p>
<p>第二步，我们就登录进来了，这时候我们会发现要进行实名认证和MX记录的验证，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-9.jpg"></p>
<p>第三步，进行实名认证，填写您真实的姓名（提示：要和最上面第二步填写的管理员姓名一致）和真实的身份证号码，点击“提交”按钮，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-10.jpg"></p>
<p>第四步，输入验证码（考验眼力的时候到了，呵呵），点击“立即认证”，会出现“审核尚未通过,请稍后重试或联系客服”的信息，这个时候怎么办呢？因为需要审核，所以我们需要等待48个小时（根据经验24小时就可以审核通过），这期间我们什么都不需要做，就等着就可以了，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-11.jpg"></p>
<p>第五步，过了48个小时以后，我们登陆网址：http://ym.163.com/，点击“登录”按钮，把标签切换到“管理员登录”的状态，输入管理账号和密码，点击“管理员登录”按钮，进入以下界面，说明已经审核通过了，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-12.jpg"></p>
<p>第六步，下面就可以给公司的员工分配企业邮箱了，具体步骤，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-13.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-14.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-15.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-16.jpg"></p>
<p>最后，我们用上面创建好的“张三”的企业邮箱，来演示下如何收发邮件，首先登陆网址：http://ym.163.com/，点击“登录”按钮，输入“张三”的邮箱地址和密码，点击“登录”按钮，具体步骤，如图示：</p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-17.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-18.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-19.jpg"></p>
<p><img decoding="async" src="https://www.3code.cn/download/2019/08/163-20.jpg"></p>
<p>全文结束。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.3code.cn/163-free-email/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>wordpress搜索自定义字段(Custom Field)内容</title>
		<link>https://www.3code.cn/wordpress-search-custom-field/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Tue, 28 Nov 2017 06:19:51 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3790</guid>

					<description><![CDATA[前段时间有个客户反映，网站搜索搜产品标题能搜出结果，但是如果搜索产品编号(备注：产品编号用自定义字段<a class="moretag" href="https://www.3code.cn/wordpress-search-custom-field/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>前段时间有个客户反映，网站搜索搜产品标题能搜出结果，但是如果搜索产品编号(备注：产品编号用自定义字段实现)是搜不出结果的，对于用户的体验不是很好。</p>
<p>确实，文章自定义字段保存在postmeta表中，而wordpress搜索仅会搜索文章表即posts表。</p>
<p>于是google了一下，有现成的解决代码，我就又当一回搬运工。</p>
<p><strong>第一步：链接查询</strong></p>
<p>也就是修改搜索查询的sql代码，将postmeta表左链接进去。</p>
<p>function cf_search_join( $join ) {<br />
global $wpdb;<br />
if ( is_search() ) {<br />
$join .=&#8217; LEFT JOIN &#8216;.$wpdb-&gt;postmeta. &#8216; ON &#8216;. $wpdb-&gt;posts . &#8216;.ID = &#8216; . $wpdb-&gt;postmeta . &#8216;.post_id &#8216;;<br />
}<br />
return $join;<br />
}<br />
add_filter(&#8216;posts_join&#8217;, &#8216;cf_search_join&#8217; );</p>
<p><strong>第二步：查询代码</strong></p>
<p>function cf_search_where( $where ) {<br />
global $pagenow, $wpdb;<br />
if ( is_search() ) {<br />
$where = preg_replace(<br />
&#8220;/\(\s*&#8221;.$wpdb-&gt;posts.&#8221;.post_title\s+LIKE\s*(\'[^\&#8217;]+\&#8217;)\s*\)/&#8221;,<br />
&#8220;(&#8220;.$wpdb-&gt;posts.&#8221;.post_title LIKE $1) OR (&#8220;.$wpdb-&gt;postmeta.&#8221;.meta_value LIKE $1)&#8221;, $where );<br />
}<br />
return $where;<br />
}<br />
add_filter( &#8216;posts_where&#8217;, &#8216;cf_search_where&#8217; );</p>
<p><strong>第三步：去重</strong></p>
<p>搜索结果很有可能有重复的，所以需要去重，很简单，在sql语句中加入DISTINCT关键字。</p>
<p>function cf_search_distinct( $where ) {<br />
global $wpdb;<br />
if ( is_search() ) {<br />
return &#8220;DISTINCT&#8221;;<br />
}<br />
return $where;<br />
}<br />
add_filter( &#8216;posts_distinct&#8217;, &#8216;cf_search_distinct&#8217; );</p>
<p>总结：</p>
<p>依次将上面三步骤中的代码加入到主题的functions.php文件中即可。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>修改WooCommerce产品描述Tab标题与删除评论tab选项卡</title>
		<link>https://www.3code.cn/how-to-change-the-woocommerce-product-description-tab-title-and-heading/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 23 Sep 2016 11:53:12 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3735</guid>

					<description><![CDATA[How to Change the WooCommerce Product Description <a class="moretag" href="https://www.3code.cn/how-to-change-the-woocommerce-product-description-tab-title-and-heading/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><strong>How to Change the WooCommerce Product Description Tab Title and Heading</strong></p>
<p>Let’s edit the WooCommerce default product page to reflect the following global changes:</p>
<p>1. Change the product description tab title from “Description” to the product name;</p>
<p>2. Change the product description tab heading from “Product Description” to “Reviews;” and</p>
<p>3. Remove the existing Reviews tab.</p>
<p>Here is an example of the WooCommerce default product page from a site using the Twenty Fourteen theme. We’ll be changing the tab section at the bottom.</p>
<p>Here are the three code snippets to add to your functions.php file (read How to Properly Add WooCommerce Custom Code for alternatives):</p>
<p>&nbsp;</p>
<p>// Change the product description tab title to the product name<br />
add_filter( &#8216;woocommerce_product_tabs&#8217;, &#8216;cb_change_product_description_tab_title&#8217; );<br />
function cb_change_product_description_tab_title( $tabs ) {<br />
global $post;<br />
if ( isset( $tabs[&#8216;description&#8217;][&#8216;title&#8217;] ) )<br />
$tabs[&#8216;description&#8217;][&#8216;title&#8217;] = $post-&gt;post_title;<br />
return $tabs;<br />
}</p>
<p>// Change the product description tab heading<br />
add_filter( &#8216;woocommerce_product_description_heading&#8217;, &#8216;cb_change_product_description_tab_heading&#8217; );<br />
function cb_change_product_description_tab_heading( $title ) {<br />
global $post;<br />
return &#8216;Reviews&#8217;;<br />
}</p>
<p>// Remove the default review tab<br />
add_filter( &#8216;woocommerce_product_tabs&#8217;, &#8216;cb_remove_reviews_tab&#8217; );<br />
function cb_remove_reviews_tab($tabs) {<br />
unset($tabs[&#8216;reviews&#8217;]);<br />
return $tabs;<br />
}</p>
<p>&nbsp;</p>
<p>To change the product description tab heading to something other than “Reviews,” substitute what you want in place of ‘Reviews’ at the end of the second code snippet.</p>
<p>Happy coding!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WooCommerce Simple Registration插件</title>
		<link>https://www.3code.cn/woocommerce-simple-registration%e6%8f%92%e4%bb%b6/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Tue, 21 Jun 2016 07:47:12 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3731</guid>

					<description><![CDATA[WooCommerce Simple Registration插件可以在WooCommerce里建立<a class="moretag" href="https://www.3code.cn/woocommerce-simple-registration%e6%8f%92%e4%bb%b6/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><strong>WooCommerce Simple Registration插件可以在WooCommerce里建立一个独立的用户注册页面。</strong></p>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>woocommerce用户密码强度修改(Woocommerce Password Strength Meter Too High)</title>
		<link>https://www.3code.cn/woocommerce-password-strength-meter-too-high/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Tue, 21 Jun 2016 07:35:46 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3727</guid>

					<description><![CDATA[woocommerce用户密码强度修改 Woocommerce Password Strength <a class="moretag" href="https://www.3code.cn/woocommerce-password-strength-meter-too-high/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>woocommerce用户密码强度修改<br />
Woocommerce Password Strength Meter Too High</p>
<p>可以用下面这个方法重设强度:</p>
<p>add_filter( &#8216;woocommerce_min_password_strength&#8217;, &#8216;uh_oh_weakpasswords&#8217; );<br />
function uh_oh_weakpasswords() {<br />
return 1;<br />
}</p>
<p>Change higher number for stronger password 1-5</p>
<p>&nbsp;</p>
<p>也可以用下面这个方法重设强度：</p>
<p><strong>Add this to your functions.phps to remove the requirements:</strong></p>
<p>function remove_wc_password_meter() {<br />
wp_dequeue_script( &#8216;wc-password-strength-meter&#8217; );<br />
}<br />
add_action( &#8216;wp_print_scripts&#8217;, &#8216;remove_wc_password_meter&#8217;, 100 );</p>
<p><strong>Then use this plugin to add/control new requirements:</strong><br />
<a href="https://wordpress.org/plugins/woocommerce-enforce-strong-password" rel="nofollow">https://wordpress.org/plugins/woocommerce-enforce-strong-password</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress注册表单增加字段及用户资料增加字段的方法</title>
		<link>https://www.3code.cn/wordpress-user-register-field/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 04 Dec 2015 14:20:29 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3715</guid>

					<description><![CDATA[把以下代码放到主题函数Functions.php里： &#60;? add_filter( &#821<a class="moretag" href="https://www.3code.cn/wordpress-user-register-field/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>把以下代码放到主题函数Functions.php里：</p>
<p>&lt;?<br />
add_filter( &#8216;user_contactmethods&#8217;, &#8216;wpgbc_add_contact_fields&#8217; );<br />
function wpgbc_add_contact_fields( $contactmethods ) {<br />
$contactmethods[&#8216;wx_hm&#8217;] = &#8216;微信号码&#8217;;<br />
$contactmethods[&#8216;sj_hm&#8217;] = &#8216;手机号码&#8217;;<br />
$contactmethods[&#8216;jz_cs&#8217;] = &#8216;居住城市&#8217;;<br />
return $contactmethods;<br />
}</p>
<p>add_action( &#8216;register_form&#8217;, &#8216;additional_profile_fields&#8217; );<br />
function additional_profile_fields() { ?&gt;<br />
&lt;p&gt;<br />
&lt;label&gt;&lt;?php _e(&#8216;微信号码&#8217;) ?&gt;&lt;br /&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;wx_hm&#8221; id=&#8221;wx_hm&#8221; class=&#8221;input&#8221; size=&#8221;25&#8243; tabindex=&#8221;20&#8243; /&gt;&lt;/label&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;<br />
&lt;label&gt;&lt;?php _e(&#8216;手机号码&#8217;) ?&gt;&lt;br /&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;sj_hm&#8221; id=&#8221;sj_hm&#8221; class=&#8221;input&#8221; size=&#8221;25&#8243; tabindex=&#8221;20&#8243; /&gt;&lt;/label&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;<br />
&lt;label&gt;&lt;?php _e(&#8216;居住城市&#8217;) ?&gt;&lt;br /&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;jz_cs&#8221; id=&#8221;jz_cs&#8221; class=&#8221;input&#8221; size=&#8221;25&#8243; tabindex=&#8221;20&#8243; /&gt;&lt;/label&gt;<br />
&lt;/p&gt;<br />
&lt;?php }<br />
// 检测表单字段是否为空，如果为空显示提示信息<br />
add_action( &#8216;register_post&#8217;, &#8216;add_register_field_validate_wx_hm&#8217;, 10, 3 );<br />
function add_register_field_validate_wx_hm( $sanitized_user_login, $user_email, $errors) {<br />
if (!isset($_POST[ &#8216;wx_hm&#8217; ]) || empty($_POST[ &#8216;wx_hm&#8217; ])) {<br />
return $errors-&gt;add( &#8216;firstnameempty&#8217;, &#8216;&lt;strong&gt;错误&lt;/strong&gt;: 请输入微信号码.&#8217; );<br />
}<br />
}<br />
add_action( &#8216;register_post&#8217;, &#8216;add_register_field_validate_sj_hm&#8217;, 10, 3 );<br />
function add_register_field_validate_sj_hm( $sanitized_user_login, $user_email, $errors) {<br />
if (!isset($_POST[ &#8216;sj_hm&#8217; ]) || empty($_POST[ &#8216;sj_hm&#8217; ])) {<br />
return $errors-&gt;add( &#8216;lastnameempty&#8217;, &#8216;&lt;strong&gt;错误&lt;/strong&gt;: 请输入手机号码.&#8217; );<br />
}<br />
}<br />
add_action( &#8216;register_post&#8217;, &#8216;add_register_field_validate_jz_cs&#8217;, 10, 3 );<br />
function add_register_field_validate_jz_cs( $sanitized_user_login, $user_email, $errors) {<br />
if (!isset($_POST[ &#8216;jz_cs&#8217; ]) || empty($_POST[ &#8216;jz_cs&#8217; ])) {<br />
return $errors-&gt;add( &#8216;lastnameempty&#8217;, &#8216;&lt;strong&gt;错误&lt;/strong&gt;: 请输入居住城市.&#8217; );<br />
}<br />
}</p>
<p>// 将用户填写的字段内容保存到数据库中<br />
add_action( &#8216;user_register&#8217;, &#8216;insert_register_fields&#8217; );<br />
function insert_register_fields( $user_id ) {</p>
<p>$wx_hm = apply_filters(&#8216;pre_user_wx_hm&#8217;, $_POST[&#8216;wx_hm&#8217;]);<br />
$sj_hm = apply_filters(&#8216;pre_user_sj_hm&#8217;, $_POST[&#8216;sj_hm&#8217;]);<br />
$jz_cs = apply_filters(&#8216;pre_user_jz_cs&#8217;, $_POST[&#8216;jz_cs&#8217;]);</p>
<p>// 以下的 &#8216;first_name&#8217; 和 &#8216;last_name&#8217; 是“我的个人资料”中已有的字段<br />
update_user_meta( $user_id, &#8216;wx_hm&#8217;, $wx_hm );<br />
update_user_meta( $user_id, &#8216;sj_hm&#8217;, $sj_hm );<br />
update_user_meta( $user_id, &#8216;jz_cs&#8217;, $jz_cs );<br />
}?&gt;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>快速解决WordPress单双引号输出为中文字符</title>
		<link>https://www.3code.cn/wordpress-yinhao/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 04 Dec 2015 14:18:16 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3713</guid>

					<description><![CDATA[方法之一，一句代码修改functions.php模板文件 remove_filter(&#8216;<a class="moretag" href="https://www.3code.cn/wordpress-yinhao/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>方法之一，一句代码修改functions.php模板文件</p>
<blockquote><p>remove_filter(&#8216;the_content&#8217;, &#8216;wptexturize&#8217;);</p></blockquote>
<p>这个方法还是不错的，简单不需要安装下面所说的插件，而且在WP程序升级的时候不会有影响。这句话就是用来禁止wptexturize函数，只能在内容中有效，标题，评论等是没有效的。</p>
<p>方法之二，Quotmarks Replacer插件解决</p>
<p>Quotmarks Replacer插件我们从WP官方下载安装，也是用来禁止wptexturize函数的，禁止把半角单双引号转化为全角格式。尽量少安装插件，不过这个插件比较小，安装也无妨。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Hostgator空间购买与账户激活教程 &#8211; 外贸美国空间</title>
		<link>https://www.3code.cn/hostgator/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Thu, 16 Jul 2015 12:34:00 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[hostgator]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3708</guid>

					<description><![CDATA[对美国以外的购买Hostgator空间的人来说，购买Hostgator后会被要求激活账户——对中国客<a class="moretag" href="https://www.3code.cn/hostgator/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>对美国以外的购买Hostgator空间的人来说，购买Hostgator后会被要求<strong>激活账户</strong>——对中国客户来说尤其如此。虽说被要求重新验证的情况是随机的，但对国人来说却几乎是百分之百的。Hostgator空间激活的方法很简单，听力好的话，就直接打电话，听力不好，可以不好就发电子邮件。本文详细解说了hostgator账户激活的方法及技巧，大家按照本文所述方法，相信一定可以成功认证你的HostGator账户的。</p>
<p>为了使账户能够顺利通过确认，激活账户，大家一定要注意以下几点：</p>
<ol>
<li><strong>填写的个人信息是真实的！</strong></li>
<li><strong>付款所用的Paypal的信息和你填写的信息与你身份证上的信息一致！</strong></li>
<li><strong>购买时填写的域名是你账户的主域名，一定要使用这个域名在hostgator主机上建站！用这个域名购买，却不用它来建站，你觉得HG会怎么想呢？它会觉得这个账户很可疑！这无形中就增加了我们激活账户的难度！</strong></li>
</ol>
<p>一般情况下，我们购买的Hostgator是自动开通的，并很快就可以收到关于空间的各种信息。但是，如果你收到下面这样的信，就必须立即打电话或通过邮寄身份证等方式来激活你的账户了。如果在规定时间内没有激活，那么你的账户就会被暂停。</p>
<blockquote><p>Email Title: Verification Needed – HostGator.com<br />
Email Content:<br />
“Hello,</p>
<p>Thank you for your order with HostGator.com!</p>
<p>In order for us to setup your account, we will need you to call us and verify your account. If you are not able to call, you can also respond to this ticket with a scanned copy of a Photo ID such as as a passport, or drivers license. Also please include a scanned copy of the credit card that was used in purchase, if you purchased a hosting account with a credit card. Please do so at your earliest convenience to ensure that your account with HostGator is setup as soon as possible.</p>
<p>Toll-free: 1-866-96-GATOR<br />
<strong>International: 001-713-574-5287（你收到的信可能不是这个电话号码）</strong></p>
<p>We are available 24/7, so please feel free to call us at your convenience. We apologize for any inconveniences. Please don’t hesitate to contact us if you have any questions, comments, or concerns.”</p></blockquote>
<p>激活账户的方法很简单，现在HG对国人激活账户的要求已经比较松了——可能也是对中国的情况了解的更多了。我们有两种方法来激活Hostgator账户：</p>
<h3>打电话激活Hostgator账户</h3>
<p>当然， 我们的电话一般都没有开通国际长途的业务，但我们可以使用免费的网络电话，比如skype等。</p>
<p>拨通后，会听到“press 1 for sales..”的提示音，我们按下”1″这个键，就会有人来接电话了。这时你可以告诉他：“I am going to verify my account”，然后他们会问你几个问题：比如你的域名，你的地址等。如果你是信用卡购买的还会被问及信用卡的最后4位数字——不过，大家肯定不会被问及了，因为中国用户只能使用Paypal付款，信用卡付款不被他们允许。</p>
<p>之后他们会告诉你：“Sir, your account will be activated in 5 minutes time…”</p>
<p>OK，恭喜你了！账户很快就可以使用了！而且，你以后再购买任何HG的产品都不用再次激活了——当然， 你得是用这个账户购买才行。如果你又用了一个新的个人信息购买了一个新的账户的话，还是会被要求激活的——甚至可能会被认为是欺诈性购买而被拒绝！</p>
<p>如果你的英语实在太差——就像我一样蹩脚的话，你可以找一个听力好的朋友帮你一下，或者，直接告诉他：My English is poor, I want to verify my account. My domain is ****.com, My Address is ******, My …… 懂我的意思吗？就是别让他问了，自己直接都告诉他得了，呵呵</p>
<h3>发送Email激活Hostgator账户</h3>
<p>英语实在不行，身边又没有什么英语好的朋友，或不愿找别人帮忙的话，你可以发送Email激活你的账户。<br />
方法是：你需要把你的身份证扫描一下，保存为01.gif，再把身份证上的信息翻译一下，保存为02.gif, 之后给sales@hostgator.com发邮件把01.gif,02.gif放在附件里，不要打包压缩)：</p>
<blockquote><p>标题：Hello, I want to verify my account．<br />
内容：Hello there, I want to confirm my order ,01.gif is the copy of my ID card, and 002.gif is to exlpain it in English．My Primary Domain name is www.xxxx.com (你的域名,必须是你注册时填写的).Thank you .<br />
附件：01.gif, 02.gif</p></blockquote>
<p>当然，如果你有护照就更好了！直接扫描过去就可以，比身份证管用。</p>
<p>现在一般这么做很快就可以通过验证了，因为比较宽松了。不过一定要注意的是：购买时的Paypal和你的身份信息要一致才行。而且，一定要用主域名建站哟！如果你不打算用这个域名建站，就不要用这个域名来购买hostgator主机了。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress建立外贸企业网站购买空间一定要注意的问题</title>
		<link>https://www.3code.cn/wordpress-hosting-faq/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 22 Aug 2014 16:08:32 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress主机]]></category>
		<category><![CDATA[wordpress企业网站]]></category>
		<category><![CDATA[wordpress空间]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3681</guid>

					<description><![CDATA[直接切入正题。 WordPress建立外贸企业网站一般都需要购买美国空间，如果空间购买不好的话，建站<a class="moretag" href="https://www.3code.cn/wordpress-hosting-faq/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>直接切入正题。</p>
<p>WordPress建立外贸企业网站一般都需要购买美国空间，如果空间购买不好的话，建站的时候经常会遇到的几个问题列出如下：</p>
<p>1. 空间是否支持mail发邮件函数。<br />
很多顾客购买的空间不支持mail函数，直接造成了网站上的询盘表单发送不成功。而大部分的wordpress都是采用的mail函数发送邮件的，所以一定要注意空间是否支持mail函数。 如果不支持，程序上还得修改成smtp发邮件的方式，又的重新写程序，故可能会造成增加写程序的费用。甚至有的空间SMTP也不支持，那就非常 麻烦了。</p>
<p>一般的支持mail函数的空间都是linux主机。 推荐选择hostgator空间，可以非常完美的支持wordpress,发邮件等功能。不用费劲，而且稳定，速度快。不建议购买godaddy,bluehost, hostmonster等空间。</p>
<p>2. 空间购买的时候一定不要选择官方中文版的。客服态度差，而且中文版的不是官方运作的。售后无保障（经验）。</p>
<p>3. 最常见的，速度要稳定，要快，要支持伪静态。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress实现ajax文章顶踩代码</title>
		<link>https://www.3code.cn/wordpress-ajax-like/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Sat, 15 Feb 2014 10:40:58 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[WORDPRESS主题技术]]></category>
		<category><![CDATA[wordpress教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3409</guid>

					<description><![CDATA[本篇教程要实现的内容为文章定踩功能，或者说“喜欢”“不喜欢”。 实现步骤： 本实例以上图所示喜欢和不<a class="moretag" href="https://www.3code.cn/wordpress-ajax-like/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>本篇教程要实现的内容为文章定踩功能，或者说“喜欢”“不喜欢”。 实现步骤： 本实例以上图所示喜欢和不喜欢为例。 <strong>一、新建数据表</strong> 新建数据表，将文章投票数据保存在新的数据表中，我们需要记录用户ID，文章ID，投票内容，用户ip，新数据表如下： <img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-3410" alt="table" src="https://www.3code.cn/download/2014/02/table.png" width="405" height="194" srcset="https://www.3code.cn/download/2014/02/table.png 405w, https://www.3code.cn/download/2014/02/table-300x143.png 300w" sizes="(max-width: 405px) 100vw, 405px" />实现新建数据表代码如下，将代码添加进主题的functions.php(或自定)文件中：</p>
<pre>    /*********更新重写规则***************/  
    function ashu_load_theme() {   
        global $pagenow;   
        if ( is_admin() &amp;&amp; 'themes.php' == $pagenow &amp;&amp; isset( $_GET['activated'] ) )   
            ashu_vote_install(); //激活主题的时候执行函数   
    }   
    add_action( 'load-themes.php', 'ashu_load_theme' );   
    function ashu_vote_install(){   
        global $wpdb;   
        //创建 _post_vote表   
        $table_name = $wpdb-&gt;prefix . 'post_vote';   
        if( $wpdb-&gt;get_var("SHOW TABLES LIKE '$table_name'") != $table_name ) :   
        $sql = " CREATE TABLE `".$wpdb-&gt;prefix."post_vote` (
          `id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,  
          `user` INT NOT NULL ,  
          `post` INT NOT NULL ,  
          `rating` varchar(10),  
          `ip` varchar(40)  
         ) ENGINE = MYISAM DEFAULT CHARSET=utf8;";   
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');   
            dbDelta($sql);   
        endif;   
    }</pre>
<p><strong>二、准备投票和查询函数</strong> 准备数据库操作函数，包括添加数据函数和查询数据，将如下函数代码也添加到主题的functions.php文件(或自定)： <strong>1、添加数据函数</strong></p>
<pre>    /*  
    *添加投票函数  
    *$post_id 文章id  
    *$user_id 用户ID  
    *$ip 用户IP  
    *$rating 投票内容  
    */  
    function add_vote($post_id,$user_id='',$ip='',$rating='up'){   
        global $wpdb;   
        $user_id = (int)$user_id;   
        $post_id = (int)$post_id;   
        if(($user_id=='')&amp;&amp;($ip=='')){   
            return "e"; //返回error   
        }   
        //检查用户对某一文章是否已经投票票了   
        if($user_id!=''){   
            $check= "select * from ".$wpdb-&gt;prefix."post_vote where post='$post_id' and user='$user_id'";   
        }else{   
            if($ip!=''){   
                $check= "select * from ".$wpdb-&gt;prefix."post_vote where post='$post_id' and ip='$ip'";   
            }   
        }   
        $coo = $wpdb-&gt;get_results($check);   
        //投票内容只能是up或者down   
        if($rating=='up'){   
            $rating='up';   
        }else{   
            $rating='down';   
        }   
        //如果不存在数据   
        if(!count($coo) &gt; 0){   
            //插入数据 sql   
            $s = "insert into ".$wpdb-&gt;prefix."post_vote (user,post,rating,ip) values('$user_id','$post_id','$rating','$ip')";   
            $wpdb-&gt;query($s);   
            return "y"; //返回yes   
        }else{   
            return "h"; //返回have   
        }   
        return "e";//返回error   
    }</pre>
<p><strong>2、查询投票数据函数</strong> 比如查询某文章点击up的数据，则使用 get_post_vote(1,&#8217;up&#8217;);</p>
<pre>    /*   
    *获取文章投票数据   
    *$post_id 文章ID   
    *$vote 投票内容   
    */   
    function get_post_vote($post_id,$vote='up'){   
        global $wpdb;   
        $post_id = (int)$post_id;   
        if($vote == 'up'){   
            $vote='up';   
        }else{   
            $vote='down';   
        }   
        //查询数据sql   
        $sql = "select count(*) from ".$wpdb-&gt;prefix."post_vote where post='$post_id' and rating='$vote'";   
        $coo = $wpdb-&gt;get_var($sql);   
        if($coo)   
        return $coo; //返回数据   
        else   
        return 0;   
    }</pre>
<p><strong>三、准备前台html和js</strong> 建立好了新的数据表，也准备好了实现投票功能的函数，接下来看前台的html和js。 1、网页前台显示数据，将下面的代码放在输出文章的循环内，即常说的loop中。</p>
<div class="dp-highlighter">&lt;span class=&#8221;vote_up&#8221; id=&#8221;&lt;?php echo &#8216;vote_up&#8217;.$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;a href=&#8221;javascript:void(0);&#8221; rel=&#8221;&lt;?php echo &#8216;up_&#8217;,$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;span id=&#8221;&lt;?php echo &#8216;vup&#8217;.$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;?php echo get_post_vote($post-&gt;ID,&#8217;up&#8217;);?&gt;<br />
&lt;/span&gt;<br />
&lt;/a&gt;<br />
人认为值得买！&lt;/span&gt;&lt;span class=&#8221;vote_down&#8221; id=&#8221;&lt;?php echo &#8216;vote_down&#8217;.$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;a href=&#8221;javascript:void(0);&#8221; rel=&#8221;&lt;?php echo &#8216;down_&#8217;.$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;span id=&#8221;&lt;?php echo &#8216;vdown&#8217;.$post-&gt;ID;?&gt;&#8221;&gt;<br />
&lt;?php echo get_post_vote($post-&gt;ID,&#8217;down&#8217;);?&gt;<br />
&lt;/span&gt;<br />
&lt;/a&gt;人认为不值得买！<br />
&lt;/span&gt;</p>
</div>
<p>上面代码将会输出一个如下的html结构<span class="vote_down" id="vote_down44"><br />
</span></p>
<p>&lt;span class=&#8221;vote_up&#8221; id=&#8221;vote_up44&#8243;&gt;<br />
&lt;a href=&#8221;javascript:void(0);&#8221; title=&#8221;值得&#8221; rel=&#8221;up_44&#8243;&gt;<br />
&lt;span id=&#8221;vup44&#8243;&gt;<br />
0<br />
&lt;/span&gt;<br />
&lt;/a&gt;<br />
人认为值得买！&lt;/span&gt;<br />
&lt;span class=&#8221;vote_down&#8221; id=&#8221;vote_down44&#8243;&gt;<br />
&lt;a href=&#8221;javascript:void(0);&#8221; title=&#8221;不值&#8221; rel=&#8221;down_44&#8243;&gt;<br />
&lt;span id=&#8221;vdown44&#8243;&gt;<br />
1<br />
&lt;/span&gt;<br />
&lt;/a&gt;人认为不值得买！<br />
&lt;/span&gt;<br />
<span class="vote_down" id="vote_down44"> </span></p>
<p><strong>四、js代码</strong></p>
<p>本篇教程中和上一篇一样，我们同样使用jquery发起ajax请求，所以首先在网页头部加载jquery代码，我在主题底部文件footer.php中加载jqeury。我将jquery-1.7.2.min.js放在了主题文件夹的js文件夹里面，所以用get_template_directory_uri()函数来输出主题的url</p>
<div class="dp-highlighter"><span><span class="tag">&lt;</span><span class="tag-name">script</span><span> </span><span class="attribute">src</span><span>=</span><span class="attribute-value">&#8220;&lt;?php echo get_template_directory_uri();?&gt;/js/jquery-1.7.2.min.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span><span>   </span></span></div>
<p>然后我将发起ajax请求代码也放在了主题里面js文件夹中的ashu.js文件，所以再加上一个 其中输出了ajax请求的地址：www.3code.cn/wp-admin/admin-ajax.php</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;var ajax_url = &#8216;&lt;?php echo admin_url(); ?&gt;admin-ajax.php&#8217;;&lt;/script&gt;<br />
&lt;script src=&#8221;&lt;?php echo get_template_directory_uri();?&gt;/js/ashu.js&#8221;&gt;&lt;/script&gt;</p>
<p>ashu.js文件中的代码:</p>
<pre>    /**     
     * by ashu.     
     * URI: http://www.ashuwp.com     
     */   

    /**   
     * 获取Cookie   
     *name  cookie名称   
     */   
    function getCookie(name) {   
        var start = document.cookie.indexOf( name + "=" );   
        var len = start + name.length + 1;   

        if ( ( !start ) &amp;&amp; ( name != document.cookie.substring( 0, name.length ) ) )   
            return null;   

        if ( start == -1 )   
            return null;   

        var end = document.cookie.indexOf( ';', len );   

        if ( end == -1 )   
            end = document.cookie.length;   
        return unescape( document.cookie.substring( len, end ) );   
    }   
    function ashu_isCookieEnable() {   
        var today = new Date();   
        today.setTime( today.getTime() );   
        var expires_date = new Date( today.getTime() + (1000 * 60) );   

        document.cookie = 'ashu_cookie_test=test;expires=' + expires_date.toGMTString() + ';path=/';   
        var cookieEnable = (getCookie('ashu_cookie_test') == 'test') ?  true : false;   
        //document.cookie = 'ludou_cookie_test=;expires=Fri, 3 Aug 2001 20:47:11 UTC;path=/';   
        return cookieEnable;   
    }   

    jQuery(document).ready(function($) {   
        var ashu_token = 1;   
        $('.vote_up a').click(function(){   
            //检查浏览器是否启用cookie功能   
            if( !ashu_isCookieEnable() ) {   
                alert("很抱歉，您不能给本文投票！");   
                return;   
            }   
            if( ashu_token != 1 ) {   
                alert("您的鼠标点得也太快了吧？！");   
                return false;   
            }   
            ashu_token = 0;   
            //获取投票a标签中的rel值   
            var full_info = $(this).attr( 'rel' );   
            var arr_param = full_info.split( '_' ); //以字符"_"分割   
            //发起ajax   
            $.ajax({   
                url:ajax_url, //ajax地址   
                type:'POST',   
                //请求的参数包括action   rating  postid三项   
                data:'action=vote_post&amp;rating=' + arr_param[ 0 ] + '&amp;postid=' + arr_param[ 1 ],   
                //返回数据   
                success:function(results){   
                    if(results=='n'){   
                        alert('评价失败');   
                        ashu_token = 1;   

                    }   
                    if (results=='y'){   
                        //如果成功，给前台数据加1   
                        var upd_vd = 'vup' + arr_param[ 1 ];   
                        $('#'+upd_vd).text(parseInt($("#"+upd_vd).text())+1);   
                        ashu_token = 1;   

                    }   
                    if (results=='h'){   
                        ashu_token = 1;   
                        alert('已经发表过评价了');   
                    }   
                    if (results=='e'){   
                        ashu_token = 1;   
                        alert('评价失败');   
                    }   
                }   
            });   
        });   

        $('.vote_down a').click(function(){   
            if( !ashu_isCookieEnable() ) {   
                alert("很抱歉，您不能给本文投票！");   
                return;   
            }   
            if(ashu_token != 1) {   
                alert("您的鼠标点得也太快了吧？！");   
                return false;   
            }   
            ashu_token = 0;   

            var full_info = $(this).attr( 'rel' );   
            var arr_param = full_info.split( '_' );   
            $.ajax({   
                url:ajax_url,   
                type:'POST',   
                data:'action=vote_post&amp;rating=' + arr_param[ 0 ] + '&amp;postid=' + arr_param[ 1 ],   
                success:function(results){   
                    if(results=='n'){   
                        alert('评价失败');   
                        ashu_token = 1;   
                    }   
                    if (results=='y'){   
                        var upd_vd = 'vdown' + arr_param[ 1 ];   
                        $("#"+upd_vd).text(parseInt($("#"+upd_vd).text())+1);   
                        ashu_token = 1;   
                    }   
                    if (results=='h'){   
                        ashu_token = 1;   
                        alert('已经发表过评价了');   
                    }   
                    if (results=='e'){   
                        ashu_token = 1;   
                        alert('发生未知错误');   
                    }   
                }   
            });   
        });   
    });</pre>
<p><strong>五、后台php处理代码。</strong> 在前面的教程中，我们的ajax请求地址直接是网站页码地址，但是本篇教程中，我们的ajax请求地址是类似：www.ashuwp.com/wp-admin/admin-ajax.php 使用这个地址来处理ajax请求，请一定记得请求中需要有action参数，然后我们只需要在functions.php文件(或自定)中添加下马代码，即可处理我们的请求，注意执行完请求输出内容之后，添加die函数结束：</p>
<pre>    /*   
    *wp的ajax都可以通过请求中的action参数来执行对应的钩子   
    *示例中我们的action参数值是vote_post   
    *所以我们可以直接用下面两个钩子来执行动作   
    */   
    add_action("wp_ajax_vote_post", "add_votes_options");   
    add_action("wp_ajax_nopriv_vote_post", "add_votes_options");   
    function add_votes_options() {   

    if( isset($_POST['action']) &amp;&amp; ($_POST['action'] == 'vote_post') ){   
        $postid = (int)$_POST['postid'];   
        if( !$postid ){   
            echo 'e'; //输出error   
            die(0);   
        }   
        //cookie中是否已经存在投票数据   
        $voted = $_COOKIE["smzdm_voted_".$postid];   
        if( $voted ){   
            echo 'h'; //输出have   
            die(0);   
        }   
        $ip = $_SERVER['REMOTE_ADDR'];//ip   
        $rating = $_POST['rating']; //投票内容   
        //判断用户是否登录   
        if(  is_user_logged_in() ){   
            global $wpdb, $current_user;   
            get_currentuserinfo();   
            $uid = $current_user-&gt;ID;   
        }else{   
            $uid='';   
        }   
        if($rating=='up'){   
            $rating='up';   
        }else{   
            $rating='down';   
        }   
        //添加数据   
        $voted = add_vote($postid,$uid,$ip,$rating);   
        if($voted=='y'){   
            //设置cookie   
            setcookie("ashu_voted_" . $postid,$rating, time() + 3000000, '/');   
            echo 'y';//输出yes   
            die(0);   
        }   
        if($voted=='h'){   
            //设置cookie   
            setcookie("ashu_voted_" . $postid,$rating, time() + 3000000, '/');   
            echo 'h';   
            die(0);   
        }   
        if($voted=='e'){   
            echo 'n';//输出no   
            die(0);   
        }   
    }else{   
        echo 'e';//输出eroor   
    }   
    die(0);   
    }</pre>
<p><strong>六、结束</strong> 本票教程并非实现定踩或喜欢功能的最佳选择，只是提供一个ajax的简单示例&#8230;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>wordpress中如何禁止或者屏蔽更新提示</title>
		<link>https://www.3code.cn/wordpressshield/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 14 Feb 2014 04:39:54 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress教程]]></category>
		<category><![CDATA[wp教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3407</guid>

					<description><![CDATA[WordPress禁止，插件更新，主题更新，wordpress本身更新提示的方法 禁止wp更新 ad<a class="moretag" href="https://www.3code.cn/wordpressshield/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><strong>WordPress禁止，插件更新，主题更新，wordpress本身更新提示的方法</strong></p>
<p>禁止wp更新</p>
<p>add_filter(&#8216;pre_site_transient_update_core&#8217;,    create_function(&#8216;$a&#8217;, &#8220;return null;&#8221;)); // 关闭核心提示</p>
<p>add_filter(&#8216;pre_site_transient_update_plugins&#8217;, create_function(&#8216;$a&#8217;, &#8220;return null;&#8221;)); // 关闭插件提示</p>
<p>add_filter(&#8216;pre_site_transient_update_themes&#8217;,  create_function(&#8216;$a&#8217;, &#8220;return null;&#8221;)); // 关闭主题提示</p>
<p>remove_action(&#8216;admin_init&#8217;, &#8216;_maybe_update_core&#8217;);    // 禁止 WordPress 检查更新</p>
<p>remove_action(&#8216;admin_init&#8217;, &#8216;_maybe_update_plugins&#8217;); // 禁止 WordPress 更新插件</p>
<p>remove_action(&#8216;admin_init&#8217;, &#8216;_maybe_update_themes&#8217;);  // 禁止 WordPress 更新主题</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress 屏蔽后台顶部导航栏 LOGO 和页脚版本信息</title>
		<link>https://www.3code.cn/wordpress-logo-copyright/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 14 Feb 2014 04:35:57 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3405</guid>

					<description><![CDATA[屏蔽 WordPress 后台页脚的版权信息和版本号，将下列代码复制到 functions.php <a class="moretag" href="https://www.3code.cn/wordpress-logo-copyright/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>屏蔽 WordPress 后台页脚的版权信息和版本号，将下列代码复制到 functions.php 即可：</p>
<div>
<table>
<tbody>
<tr>
<td>
<pre>/**
 * 屏蔽后台页脚版本号
 */
function change_footer_admin () {return '';}
add_filter('admin_footer_text', 'change_footer_admin', 9999);
function change_footer_version() {return '';}
add_filter( 'update_footer', 'change_footer_version', 9999);</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>屏蔽 WordPress 后台导航栏最左侧的 WordPress LOGO，同样复制下列代码到 functions.php：</p>
<div>
<table>
<tbody>
<tr>
<td>
<pre>/**
 * 屏蔽后台导航栏LOGO
 */
function annointed_admin_bar_remove() {
        global $wp_admin_bar;
        /* Remove their stuff */
        $wp_admin_bar-&gt;remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);</pre>
</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress自定义后台登录界面的LOGO</title>
		<link>https://www.3code.cn/wordpress-custom-logo/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Sat, 25 Jan 2014 05:23:17 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3402</guid>

					<description><![CDATA[把下面的代码复制到您主题的文件Functions.php中 &#160; /*自定义后台登录LOGO<a class="moretag" href="https://www.3code.cn/wordpress-custom-logo/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>把下面的代码复制到您主题的文件Functions.php中</p>
<p>&nbsp;</p>
<p>/*自定义后台登录LOGO*/<br />
function custom_loginlogo() {<br />
echo &#8216;&lt;style type=&#8221;text/css&#8221;&gt;<br />
h1 a {background-image: url(&#8216;.get_bloginfo(&#8216;template_directory&#8217;).&#8217;/images/login_logo.png) !important; }<br />
&lt;/style&gt;&#8217;;<br />
}<br />
add_action(&#8216;login_head&#8217;, &#8216;custom_loginlogo&#8217;);</p>
<p>然后把login_logo.png这个文件放到你主题下的images目录下。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress用户只能查看自己的文章与评论</title>
		<link>https://www.3code.cn/wordpress-user/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Sat, 25 Jan 2014 05:20:52 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3400</guid>

					<description><![CDATA[把下面的代码复制到您的主题下面的Functions.php中。 /*只能查看自己的文章评论*/ fu<a class="moretag" href="https://www.3code.cn/wordpress-user/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>把下面的代码复制到您的主题下面的Functions.php中。</p>
<p>/*只能查看自己的文章评论*/<br />
function wpdx_get_comment_list_by_user($clauses) {<br />
if (is_admin()) {<br />
global $user_ID, $wpdb;<br />
$clauses[&#8216;join&#8217;] = &#8220;, wp_posts&#8221;;<br />
$clauses[&#8216;where&#8217;] .= &#8221; AND wp_posts.post_author = &#8220;.$user_ID.&#8221; AND wp_comments.comment_post_ID = wp_posts.ID&#8221;;<br />
};<br />
return $clauses;<br />
};<br />
if(!current_user_can(&#8216;edit_others_posts&#8217;)) {<br />
add_filter(&#8216;comments_clauses&#8217;, &#8216;wpdx_get_comment_list_by_user&#8217;);<br />
}</p>
<p>/*只能查看自己发布的文章*/<br />
function wpjam_parse_query_useronly( $wp_query ) {<br />
if ( strpos( $_SERVER[ &#8216;REQUEST_URI&#8217; ], &#8216;/wp-admin/edit.php&#8217; ) !== false ) {<br />
if ( !current_user_can( &#8216;add_user&#8217; ) ) {<br />
global $current_user;<br />
$wp_query-&gt;set( &#8216;author&#8217;, $current_user-&gt;id );<br />
}<br />
}<br />
}<br />
add_filter(&#8216;parse_query&#8217;, &#8216;wpjam_parse_query_useronly&#8217; );</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>新手如何通过WordPress来开展自己的外贸之路</title>
		<link>https://www.3code.cn/wordpresstrade/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Fri, 22 Nov 2013 02:19:36 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[WordPress做外贸网站]]></category>
		<category><![CDATA[wordpress外贸主题]]></category>
		<category><![CDATA[Wordpress外贸企业主题]]></category>
		<category><![CDATA[WordPress外贸网站建设]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3357</guid>

					<description><![CDATA[大家都知道现在要做外贸，必须要有一个自己的外贸网站，以用来得到询盘与提供产品展示给客户看。但是建立外<a class="moretag" href="https://www.3code.cn/wordpresstrade/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignright  wp-image-3362" alt="wordpress" src="https://www.3code.cn/download/2013/11/wordpress1.jpg" width="100" height="90" />大家都知道现在要做外贸，必须要有一个自己的外贸网站，以用来得到询盘与提供产品展示给客户看。但是建立外贸网站现在市面上多之又多，很多人不知道用什么程序来建立自己的外贸网站，或者报着刚创业资金不足的想法随便找公司或者个人做一个网站，这思路可以理解，但绝对是不可取的，因为这简直是在浪费钱，这样的外贸网站几乎形同摆设，毫无意义。那下面来说下用<strong><a href="https://www.3code.cn">WordPress做外贸网站</a></strong>的方法，努力去做的话一定可以给您带来非常好的效果。</p>
<p><img decoding="async" alt="domain" src="https://www.3code.cn/download/2013/11/domain.jpg" width="300" height="300" /><img loading="lazy" decoding="async" alt="cpanel" src="https://www.3code.cn/download/2013/11/cpanel.jpg" width="300" height="300" /></p>
<p><strong>前期准备资料：</strong></p>
<ul>
<li>注册一个与您做的产品相关的域名</li>
<li>购买一个支持WordPress的美国空间：一般都用Linux下的Cpanel平台</li>
<li>下载最新版的WordPress程序</li>
<li>选择一个适合自己的产品的WordPress企业主题模板</li>
</ul>
<p>&nbsp;<br />
<strong>操作方法：</strong></p>
<ul>
<li>注册域名。 一定要用自己的产品关键字来注册域名。最好是.com的域名。域名可以去国内域名注册商或者国外域名注册商注册都可以。</li>
<li>购买一个支持WordPress的美国空间：一般都用Linux下的Cpanel平台。去国外比较知名的空间商那里购买一个Linux空间，一般都支持WordPress。如果自己不会购买可以找人代购。</li>
<li>将域名解析到购买的空间的IP。如何解析可以让空间商代为解析或者找懂技术的人员帮您解析。</li>
<li>解析域名后，下载WordPress程序最新版。上传到刚购买的空间上，输入域名一步步根据提示安装好WordPress系统。</li>
<li>选择好一个WordPress外贸企业主题模板，在WordPress后台安装上这个主题模板。然后进行与您网站相关的设置。比如网站名称，网站标题关键字，产品分类，关于我们等这些基本的设置。</li>
<li>根据自己的情况来发布产品与新闻，产品与新闻发布的时候要围绕您的产品相关的资料发布。合理的安排关键字，文章内容要原创。</li>
<li>接下来您就不断的更新您的网站，适当的加一些高权重的外链，这些工作要坚持做。这样子持续下去的话，您就等着网站给您带来询盘吧。</li>
</ul>
<p>&nbsp;<br />
<strong>注意事项</strong></p>
<ul>
<li>​一定要选择一个产品关键字做域名</li>
<li>​一定要选择一个好的稳定的美国空间</li>
<li>​一定要选择一个好的<strong><a title="WordPress外贸企业主题" href="https://www.3code.cn">WordPress外贸企业主题</a></strong>模板</li>
<li>一定要支持原创内容</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>用WordPress建个企业网站要多少钱</title>
		<link>https://www.3code.cn/wordpressprice/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Tue, 12 Nov 2013 10:31:38 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress主题]]></category>
		<category><![CDATA[wordpress企业主题]]></category>
		<category><![CDATA[wordpress博客主题]]></category>
		<category><![CDATA[Wordpress建站]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3316</guid>

					<description><![CDATA[用WordPress建个企业网站要多少钱 WordPress建立网站在国内越来越火了，在网上一搜索有<a class="moretag" href="https://www.3code.cn/wordpressprice/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><strong>用WordPress建个企业网站要多少钱</strong></p>
<p>WordPress建立网站在国内越来越火了，在网上一搜索有很多国内外<strong>WordPress主题</strong>、<strong><a title="WordPress企业主题" href="https://www.3code.cn">WordPress企业主题</a></strong>, <strong>WordPress博客主题</strong>及各种类型的<strong>WordPress企业模板</strong>及<strong>WordPress CMS主题</strong>模板等。</p>
<p>用WordPress建立企业网站的价格根据要求也是大不一样。主要区别在于以下几点，下面我们来简单分析下。</p>
<p><strong>一、先说下传统建站的价格</strong></p>
<p>传统建站是指的建站公司用自己开发的后台（如：ASP，PHP，JSP，ASP.NET等语言开发的），专门针对这个网站定制的后台。</p>
<p>这种建站流程一般是：客户提出要求 》 建站公司设计界面 》 客户确认 》  建站公司根据界面定制程序 》 客户审核 》 结束。 网站制作的价格一方面与客户要求的功能有关，复杂的价格高，简单的价格就低。公司不同收费也不同，大公司牌子大，收费就高。</p>
<p>传统的建站价格区间是：1. 简单的网站一般3000左右。  2. 功能定制性稍复杂些的5000-15000之间。 3. 门户型网站大型网站一般都在20000以上。</p>
<p><strong>二、用WordPress建站的价格</strong></p>
<p>用WordPress建站又分为多种形式。 WordPress建站类型简单可以分为以下几种类型：</p>
<p><strong>1. 用现成的WordPress主题建立网站.<br />
</strong><br />
1) 上面已经说过，<a href="https://www.3code.cn"><strong>WordPress企业主题</strong></a>、<strong>WordPress博客主题</strong>、<strong>WordPress CMS 主题</strong>目前网上已经有很多，有收费的主题也有免费的主题。如果你选择免费的主题，您不用花一分钱在主题上面，您所要花的钱只是购买域名与空间的费用。前提是您要懂的WordPress相关的一些技术。免费的<strong>WordPress企业主题</strong>网上不多，一般的<strong>WordPress企业主题</strong>都是收费的。</p>
<p>用收费的<strong>WordPress企业主题</strong>建立网站的话，直接购买WordPress企业主题的价格一般是在50-100美元左右，也就是折合人民币300-600之间。 这种价格同样要求你必须懂WordPress技术，要会安装，会使用，会设置。一般的企业如果没有技术人员的话这是不可能做到的。</p>
<p><strong>2) 用收费的WordPress企业主题 + 技术服务</strong></p>
<p>就是购买一个收费的WordPress企业主题，然后安装，配置，技术指导等这些服务也由主题提供者来完成，或者另找一家懂WordPress的公司或者个人来帮您完成。说白了就是购买技术服务。技术服务这块国内好像不大认可，觉得我买了你们的主题了你就应该把主题安装好，调试好，并教会我怎么使用它。这种想法其实是一种误区，WordPress企业主题由主题开发者做好后，一般都提供安装与设置说明、并提供使用方法。如果再额外要求主题开发者一对一的教你如果使用如何安装设置，那这个价格基本上是不可能的。 国外的主题开发者都是明确标明服务价格都在500美元以上的。</p>
<p>在国内，用收费的WordPress企业主题 + 技术服务的价格一般在1500-3000左右。不同的主题不同的价格。不能一概而论。</p>
<p><strong>2.  用WordPress定制企业主题，定制企业网站</strong></p>
<p>这个与传统建站有点类似，不同的是开发者可以少写一部分后台代码。其它都是大致相同。<strong>WordPress企业主题</strong>定制的价格也是根据功能要求来算的，而且会比传统建站更复杂一些，价格上不会比传统建站低到哪里去。</p>
<p>以上只是笔者的几点看法。 敬请指正。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>wordpress常用函数集分类说明</title>
		<link>https://www.3code.cn/wordpress-functions-2/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Tue, 30 Oct 2012 06:08:23 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress函数]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3075</guid>

					<description><![CDATA[WordPress模板基本文件 style.css 样式表文件 index.php 主页文件 sin<a class="moretag" href="https://www.3code.cn/wordpress-functions-2/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p><strong>WordPress模板基本文件</strong></p>
<p>style.css 样式表文件<br />
index.php 主页文件<br />
single.php 日志单页文件<br />
page.php 页面文件<br />
archvie.php 分类和日期存档页文件<br />
searchform.php 搜索表单文件<br />
search.php 搜索页面文件<br />
comments.php 留言区域文件(包括留言列表和留言框)<br />
404.php 404错误页面<br />
header.php 网页头部文件<br />
sidebar.php 网页侧边栏文件<br />
footer.php 网页底部文件</p>
<p><strong>WordPress Header头部 PHP代码 (注: 也就是位于&lt;head&gt;和&lt;/head&gt;之间的PHP代码)</strong></p>
<p>&lt;?php bloginfo(’name’); ?&gt; 网站标题<br />
&lt;?php wp_title(); ?&gt; 日志或页面标题<br />
&lt;?php bloginfo(’stylesheet_url’); ?&gt; WordPress主题样式表文件style.css的相对地址<br />
&lt;?php bloginfo(’pingback_url’); ?&gt; WordPress博客的Pingback地址<br />
&lt;?php bloginfo(’template_url’); ?&gt; WordPress主题文件的相对地址<br />
&lt;?php bloginfo(’version’); ?&gt; 博客的WordPress版本<br />
&lt;?php bloginfo(’atom_url’); ?&gt; WordPress博客的Atom地址<br />
&lt;?php bloginfo(’rss2_url’); ?&gt; WordPress博客的RSS2地址<br />
&lt;?php bloginfo(’url’); ?&gt; WordPress博客的绝对地址<br />
&lt;?php bloginfo(’name’); ?&gt; WordPress博客的名称<br />
&lt;?php bloginfo(’html_type’); ?&gt; 网站的HTML版本<br />
&lt;?php bloginfo(’charset’); ?&gt; 网站的字符编码格式</p>
<p><strong>WordPress 主体模板 PHP代码</strong></p>
<p>&lt;?php the_content(); ?&gt; 日志内容<br />
&lt;?php if(have_posts()) : ?&gt; 确认是否有日志<br />
&lt;?php while(have_posts()) : the_post(); ?&gt; 如果有，则显示全部日志<br />
&lt;?php endwhile; ?&gt; 结束PHP函数”while”<br />
&lt;?php endif; ?&gt; 结束PHP函数”if”<br />
&lt;?php get_header(); ?&gt; header.php文件的内容<br />
&lt;?php get_sidebar(); ?&gt; sidebar.php文件的内容<br />
&lt;?php get_footer(); ?&gt; footer.php文件的内容<br />
&lt;?php the_time(’m-d-y’) ?&gt; 显示格式为”02-19-08″的日期<br />
&lt;?php comments_popup_link(); ?&gt; 显示一篇日志的留言链接<br />
&lt;?php the_title(); ?&gt; 显示一篇日志或页面的标题<br />
&lt;?php the_permalink() ?&gt; 显示一篇日志或页面的永久链接/URL地址<br />
&lt;?php the_category(’, ‘) ?&gt; 显示一篇日志或页面的所属分类<br />
&lt;?php the_author(); ?&gt; 显示一篇日志或页面的作者<br />
&lt;?php the_ID(); ?&gt; 显示一篇日志或页面的ID<br />
&lt;?php edit_post_link(); ?&gt; 显示一篇日志或页面的编辑链接<br />
&lt;?php get_links_list(); ?&gt; 显示Blogroll中的链接<br />
&lt;?php comments_template(); ?&gt; comments.php文件的内容<br />
&lt;?php wp_list_pages(); ?&gt; 显示一份博客的页面列表<br />
&lt;?php wp_list_cats(); ?&gt; 显示一份博客的分类列表<br />
&lt;?php next_post_link(’ %link ‘) ?&gt; 下一篇日志的URL地址<br />
&lt;?php previous_post_link(’%link’) ?&gt; 上一篇日志的URL地址<br />
&lt;?php get_calendar(); ?&gt; 调用日历<br />
&lt;?php wp_get_archives() ?&gt; 显示一份博客的日期存档列表<br />
&lt;?php posts_nav_link(); ?&gt; 显示较新日志链接(上一页)和较旧日志链接（下一页）<br />
&lt;?php bloginfo(’description’); ?&gt; 显示博客的描述信息</p>
<p><strong>其它的一些WordPress模板代码</strong></p>
<p>/%postname%/ 显示博客的自定义永久链接<br />
&lt;?php the_search_query(); ?&gt; 搜索表单的值<br />
&lt;?php _e(’Message’); ?&gt; 打印输出信息<br />
&lt;?php wp_register(); ?&gt; 显示注册链接<br />
&lt;?php wp_loginout(); ?&gt; 显示登入/登出链接<br />
&lt;!–next page–&gt; 在日志或页面中插入分页<br />
&lt;!–more–&gt; 截断日志<br />
&lt;?php wp_meta(); ?&gt; 显示管理员的相关控制信息<br />
&lt;?php timer_stop(1); ?&gt; 显示载入页面的时间<br />
&lt;?php echo get_num_queries(); ?&gt; 显示载入页面查询</p>
<p>&nbsp;</p>
<p><strong>1. wordpress调用最新文章</strong></p>
<p>WordPress最新文章的调用可以使用一行很简单的模板标签wp_get_archvies来实现. 代码如下：</p>
<p>&lt;?php get_archives(‘postbypost’, 10); ?&gt; (显示10篇最新更新文章)</p>
<p>或者</p>
<p>&lt;?php wp_get_archives(‘type=postbypost&amp;limit=20&amp;format=custom’); ?&gt;</p>
<p>后面这个代码显示你博客中最新的20篇文章，其中format=custom这里主要用来自定义这份文章列表的显示样式。具体的参数和使用方法你可 以参考官方的使用说明- wp_get_archvies。(fromat=custom也可以不要，默认以UL列表显示文章标题。)</p>
<p>补充: 通过WP的query_posts()函数也能调用最新文章列表， 虽然代码会比较多一点，但可以更好的控制Loop的显示，比如你可以设置是否显示摘要。具体的使用方法也可以查看官方的说明。</p>
<p><strong>2. wordpress调用随机文章</strong></p>
<p>&lt;?php<br />
$rand_posts = get_posts(‘numberposts=10&amp;orderby=rand’);<br />
foreach( $rand_posts as $post ) :<br />
?&gt;<br />
&lt;!–下面是你想自定义的Loop–&gt;<br />
&lt;li&gt;&lt;a href=”&lt;?php the_permalink(); ?&gt;”&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php endforeach; ?&gt;</p>
<p><strong>3. wordpress调用最新留言</strong></p>
<p>下面是我之前在一个WordPress主题中代到的最新留言代码，具体也记不得是哪个主题了。该代码直接调用数据库显示一份最新留言。其中 LIMIT 10限制留言显示数量。绿色部份则是每条留言的输出样式。</p>
<p>&lt;?php<br />
global $wpdb;<br />
$sql = “SELECT DISTINCT ID, post_title, post_password, comment_ID,<br />
comment_post_ID, comment_author, comment_date_gmt, comment_approved,<br />
comment_type,comment_author_url,<br />
SUBSTRING(comment_content,1,30) AS com_excerpt<br />
FROM $wpdb-&gt;comments<br />
LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =<br />
$wpdb-&gt;posts.ID)<br />
WHERE comment_approved = ’1′ AND comment_type = ” AND<br />
post_password = ”<br />
ORDER BY comment_date_gmt DESC<br />
LIMIT 10″;<br />
$comments = $wpdb-&gt;get_results($sql);<br />
$output = $pre_HTML;   foreach ($comments as $comment) {<br />
$output .= “n&lt;li&gt;”.strip_tags($comment-&gt;comment_author)<br />
.”:” . ” &lt;a href=”&#8221; . get_permalink($comment-&gt;ID) .<br />
“#comment-” . $comment-&gt;comment_ID . “” title=”on ” .<br />
$comment-&gt;post_title . “”&gt;” . strip_tags($comment-&gt;com_excerpt)<br />
.”&lt;/a&gt;&lt;/li&gt;”;<br />
}   $output .= $post_HTML;<br />
echo $output;?&gt;</p>
<p><strong>4.wordpress调用相关文章</strong></p>
<p>在文章页显示相关文章</p>
<p>&lt;?php</p>
<p>$tags = wp_get_post_tags($post-&gt;ID);</p>
<p>if ($tags) {</p>
<p>$first_tag = $tags[0]-&gt;term_id;</p>
<p>$args=array(</p>
<p>‘tag__in’ =&gt; array($first_tag),</p>
<p>‘post__not_in’ =&gt; array($post-&gt;ID),</p>
<p>‘showposts’=&gt;10,</p>
<p>‘caller_get_posts’=&gt;1</p>
<p>);</p>
<p>$my_query = new WP_Query($args);</p>
<p>if( $my_query-&gt;have_posts() ) {</p>
<p>while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;</p>
<p>&lt;li&gt;&lt;a href=”&lt;?php the_permalink() ?&gt;” rel=”bookmark” title=”&lt;?php the_title_attribute(); ?&gt;”&gt;&lt;?php the_title();?&gt; &lt;?php comments_number(‘ ‘,’(1)’,'(%)’); ?&gt;&lt;/a&gt;&lt;/li&gt;</p>
<p>&lt;?php</p>
<p>endwhile;</p>
<p>}</p>
<p>}</p>
<p>wp_reset_query();</p>
<p>?&gt;</p>
<p><strong>5.wordpress调用指定分类的文章</strong></p>
<p>&lt;?php $posts = get_posts( “category=4&amp;numberposts=10″ ); ?&gt;<br />
&lt;?php if( $posts ) : ?&gt;<br />
&lt;ul&gt;&lt;?php foreach( $posts as $post ) : setup_postdata( $post ); ?&gt;<br />
&lt;li&gt;<br />
&lt;a href=”&lt;?php the_permalink() ?&gt;” rel=”bookmark” title=”&lt;?php the_title(); ?&gt;”&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/ul&gt;<br />
&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p><strong>6.wordpress去评论者链接的评论输出</strong></p>
<p>&lt;?php</p>
<p>global $wpdb;</p>
<p>$sql = “SELECT DISTINCT ID, post_title, post_password, comment_ID,</p>
<p>comment_post_ID, comment_author, comment_date_gmt, comment_approved,</p>
<p>comment_type,comment_author_url,</p>
<p>SUBSTRING(comment_content,1,14) AS com_excerpt</p>
<p>FROM $wpdb-&gt;comments</p>
<p>LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =</p>
<p>$wpdb-&gt;posts.ID)</p>
<p>WHERE comment_approved = ’1′ AND comment_type = ” AND</p>
<p>post_password = ”</p>
<p>ORDER BY comment_date_gmt DESC</p>
<p>LIMIT 10″;</p>
<p>$comments = $wpdb-&gt;get_results($sql);</p>
<p>$output = $pre_HTML;</p>
<p>foreach ($comments as $comment) {</p>
<p>$output .= “\n&lt;li&gt;”.strip_tags($comment-&gt;comment_author)</p>
<p>.”:” . ” &lt;a href=\”&#8221; . get_permalink($comment-&gt;ID) .</p>
<p>“#comment-” . $comment-&gt;comment_ID . “\” title=\”on ” .</p>
<p>$comment-&gt;post_title . “\”&gt;” . strip_tags($comment-&gt;com_excerpt)</p>
<p>.”&lt;/a&gt;&lt;/li&gt;”;</p>
<p>}</p>
<p>$output .= $post_HTML;</p>
<p>echo $output;?&gt;</p>
<p><strong>7.wordpress调用含gravatar头像的评论输出</strong></p>
<p>&lt;?php</p>
<p>global $wpdb;</p>
<p>$sql = “SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_author_url, SUBSTRING(comment_content,1,10) AS com_excerpt FROM $wpdb-&gt;comments LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID = $wpdb-&gt;posts.ID) WHERE comment_approved = ’1′ AND comment_type = ” AND comment_author != ‘郑 永’ AND post_password = ” ORDER BY comment_date_gmt DESC LIMIT 10″;</p>
<p>$comments = $wpdb-&gt;get_results($sql);</p>
<p>$output = $pre_HTML;</p>
<p>foreach ($comments as $comment) {</p>
<p>$output .= “\n&lt;li&gt;”.get_avatar(get_comment_author_email(‘comment_author_email’), 18). ” &lt;a href=\”&#8221; . get_permalink($comment-&gt;ID) . “#comment-” . $comment-&gt;comment_ID . “\” title=\”&#8221; . $comment-&gt;post_title . ” 上的评论\”&gt;”. strip_tags($comment-&gt;comment_author) .”： “. strip_tags($comment-&gt;com_excerpt) .”&lt;/a&gt;&lt;/li&gt;”;</p>
<p>}</p>
<p>$output .= $post_HTML;</p>
<p>$output = convert_smilies($output);</p>
<p>echo $output;</p>
<p>?&gt;</p>
<p>上面代码把comment_author的值改成你的ID，18是头像大小，10是评论数量。</p>
<p><strong>8.wordpress调用网站统计大全</strong></p>
<p>1、日志总数：</p>
<p>&lt;?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts-&gt;publish;?&gt;</p>
<p>2、草稿数目：</p>
<p>&lt;?php $count_posts = wp_count_posts(); echo $draft_posts = $count_posts-&gt;draft; ?&gt;</p>
<p>3、评论总数：</p>
<p>&lt;?php echo $wpdb-&gt;get_var(“SELECT COUNT(*) FROM $wpdb-&gt;comments”);?&gt;</p>
<p>4、成立时间：</p>
<p>&lt;?php echo floor((time()-strtotime(“2008-8-18″))/86400); ?&gt;</p>
<p>5、标签总数：</p>
<p>&lt;?php echo $count_tags = wp_count_terms(‘post_tag’); ?&gt;</p>
<p>6、页面总数：</p>
<p>&lt;?php $count_pages = wp_count_posts(‘page’); echo $page_posts = $count_pages-&gt;publish; ?&gt;</p>
<p>7、分类总数：</p>
<p>&lt;?php echo $count_categories = wp_count_terms(‘category’); ?&gt;</p>
<p>8、链接总数：</p>
<p>&lt;?php $link = $wpdb-&gt;get_var(“SELECT COUNT(*) FROM $wpdb-&gt;links WHERE link_visible = ‘Y’”); echo $link; ?&gt;</p>
<p>9、用户总数：</p>
<p>&lt;?php $users = $wpdb-&gt;get_var(“SELECT COUNT(ID) FROM $wpdb-&gt;users”); echo $users; ?&gt;</p>
<p>10、最后更新：</p>
<p>&lt;?php $last = $wpdb-&gt;get_results(“SELECT MAX(post_modified) AS MAX_m FROM $wpdb-&gt;posts WHERE (post_type = ‘post’ OR post_type = ‘page’) AND (post_status = ‘publish’ OR post_status = ‘private’)”);$last = date(‘Y-n-j’, strtotime($last[0]-&gt;MAX_m));echo $last; ?&gt;</p>
<p>&nbsp;</p>
<p><strong>9.wordpress判断语句</strong></p>
<p>is_single()</p>
<p>判断是否是具体文章的页面</p>
<p>is_single(’2′)</p>
<p>判断是否是具体文章（id=2）的页面</p>
<p>is_single(’Beef Stew’)</p>
<p>判断是否是具体文章（标题判断）的页面</p>
<p>is_single(’beef-stew’)</p>
<p>判断是否是具体文章（slug判断）的页面</p>
<p>comments_open()</p>
<p>是否留言开启</p>
<p>pings_open()</p>
<p>是否开启ping</p>
<p>is_page()</p>
<p>是否是页面</p>
<p>is_page(’42′)</p>
<p>id判断，即是否是id为42的页面</p>
<p>is_page(’About Me’)</p>
<p>判断标题</p>
<p>is_page(’about-me’)</p>
<p>slug判断</p>
<p>is_category()</p>
<p>是否是分类</p>
<p>is_category(’6′)</p>
<p>id判断，即是否是id为6的分类</p>
<p>is_category(’Cheeses’)</p>
<p>分类title判断</p>
<p>is_category(’cheeses’)</p>
<p>分类 slug判断</p>
<p>in_category(’5′)</p>
<p>判断当前的文章是否属于分类5</p>
<p>is_author()</p>
<p>将所有的作者的页面显示出来</p>
<p>is_author(’1337′)</p>
<p>显示author number为1337的页面</p>
<p>is_author(’Elite Hacker’)</p>
<p>通过昵称来显示当前作者的页面</p>
<p>is_author(’elite-hacker’)</p>
<p>下面是通过不同的判断实现以年、月、日、时间等方式来显示归档</p>
<p>is_date()</p>
<p>is_year()</p>
<p>is_month()</p>
<p>is_day()</p>
<p>is_time()</p>
<p>判断当前是否是归档页面</p>
<p>is_archive()</p>
<p>判断是否是搜索</p>
<p>is_search()</p>
<p>判断页面是否404</p>
<p>is_404()</p>
<p>判断是否翻页，比如你当前的blog是http://domain.com 显示http://domain.com?paged=2的时候，这个判断将返 回真，通过这个函数可以配合is_home来控制某些只能在首页显示的界面，</p>
<p>例如：</p>
<p>&lt;?php if(is_single()):?&gt;</p>
<p>//这里写你想显示的内容，包括函数</p>
<p>&lt;?php endif;?&gt;</p>
<p>或者：</p>
<p>&lt;?php if(is_home() &amp;&amp; !is_paged() ):?&gt;</p>
<p>//这里写你想显示的内容，包括函数</p>
<p>&lt;?php endif;?&gt;</p>
<p><strong>10.wordpress 非插件调用评论表情</strong></p>
<p>&lt;!–smilies–&gt;<br />
&lt;?php</p>
<p>function wp_smilies() {</p>
<p>global $wpsmiliestrans;</p>
<p>if ( !get_option(‘use_smilies’) or (empty($wpsmiliestrans))) return;</p>
<p>$smilies = array_unique($wpsmiliestrans);</p>
<p>$link=”;</p>
<p>foreach ($smilies as $key =&gt; $smile) {</p>
<p>$file = get_bloginfo(‘wpurl’).’/wp-includes/images/smilies/’.$smile;</p>
<p>$value = ” “.$key.” “;</p>
<p>$img = “&lt;img src=\”{$file}\” alt=\”{$smile}\” /&gt;”;</p>
<p>$imglink = htmlspecialchars($img);</p>
<p>$link .= “&lt;a href=\”#commentform\” title=\”{$smile}\” onclick=\”document.getElementById(‘comment’).value += ‘{$value}’\”&gt;{$img}&lt;/a&gt; ”;</p>
<p>}</p>
<p>echo ‘&lt;div&gt;’.$link.’&lt;/div&gt;’;</p>
<p>}</p>
<p>?&gt;</p>
<p>&lt;?php wp_smilies();?&gt;</p>
<p>&lt;!–smilies—&gt;</p>
<p>将以上代码复制到 comments.php 中合适的位置。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>wordpress密码正确,后台无法登陆解决办法</title>
		<link>https://www.3code.cn/wordpress-login/</link>
		
		<dc:creator><![CDATA[寒林]]></dc:creator>
		<pubDate>Mon, 22 Oct 2012 12:59:33 +0000</pubDate>
				<category><![CDATA[WORDPRESS教程]]></category>
		<category><![CDATA[wordpress登录]]></category>
		<guid isPermaLink="false">https://www.3code.cn/?p=3071</guid>

					<description><![CDATA[一般国外空间不会出现这个情况，主要是国内空间。 已经多次遇到客户wordpress无法登陆的情况，而<a class="moretag" href="https://www.3code.cn/wordpress-login/"> 阅读更多&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>一般国外空间不会出现这个情况，主要是国内空间。<br />
已经多次遇到客户wordpress无法登陆的情况，而密码经过确认都是正确的，倘若密码不正确，登陆时会提示错误，如果不提示继续返回登陆页面，则说 明密码是正确的。至于出现这种状况的原因，大概是因为升级了wordpress程序而导致的。博客从3.1版本升级到3.3版本的时候，就出现了 wordpress无法登陆的问题了。</p>
<p>修改方式是：打开文件”/wp-includes/pluggable.php“, 把：<br />
setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);<br />
修改为：<br />
setcookie($auth_cookie_name, $auth_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure, true);</p>
<p>经过博主的实验可以解决无法登录的问题。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
