<?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>博客联盟 &#187; wordpress</title>
	<atom:link href="http://blogunion.org/category/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://blogunion.org</link>
	<description>含博客技巧，博客赚钱，博客推广优化，博客营销，博客工具，博客资讯以及wordpress相关的内容。</description>
	<lastBuildDate>Mon, 07 May 2012 15:02:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>隐藏WordPress某一分类文章的三个插件</title>
		<link>http://blogunion.org/wordpress/wordpress-plugins/3-plugins-for-hiding-post-from-wordpress.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-plugins/3-plugins-for-hiding-post-from-wordpress.html#comments</comments>
		<pubDate>Tue, 30 Aug 2011 07:27:47 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress插件]]></category>
		<category><![CDATA[Front Page Category]]></category>
		<category><![CDATA[WP Filter Post Category]]></category>
		<category><![CDATA[WP Hide Post]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1262</guid>
		<description><![CDATA[Front Page Category 安装这个插件后，会在WordPress控制面板“设置”那里生成一个Front Page Categories选项。默认是所有分类都在首页显示的，你只需把不想显示分类前面的勾选去除即可。 插件地址：ht... ]]></description>
			<content:encoded><![CDATA[<p><strong>Front Page Category</strong></p>
<p>安装这个插件后，会在WordPress控制面板“设置”那里生成一个Front Page Categories选项。默认是所有分类都在首页显示的，你只需把不想显示分类前面的勾选去除即可。</p>
<p>插件地址：<a href="http://www.forexp.net/front-page-category/" target="_blank">http://www.forexp.net/front-page-category/</a></p>
<p><strong>WP Filter Post Category</strong></p>
<p>这个插件的作用比Front Page Category 要强大一些。启用该插件后，除了首页外，导航分页、存档页，甚至搜索结果页都不会显示。</p>
<p>插件地址：<a href="http://wordpress.phpanswer.com/wpplugins/wp-filter-post-categories/" target="_blank">http://wordpress.phpanswer.com/wpplugins/wp-filter-post-categories/</a></p>
<p>以上两个插件的功能都很强大，但都是直接隐藏某一分类下面所有的文章，可控性不是非常强。下面介绍的第三个插件则直接是针对具体某一篇文章的，可控性非常高。</p>
<p><strong>WP Hide Post</strong></p>
<p>这个插件启用后，后台不会有显示。只有当你撰写文章，或者修改文章的时候，才会在侧边栏显示，功能强大。你可以设定某一篇文章是否在首页、分类页、标签页、存档页、搜索结果页、以及feed中显示等等。</p>
<p>插件地址：<a href="http://anappleaday.konceptus.net/posts/wp-hide-post/" target="_blank">http://anappleaday.konceptus.net/posts/wp-hide-post/</a></p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2007年11月30日 -- <a href="http://blogunion.org/blogging-tips/why-i-blog-1.html" title="我为什么写博客（一）：阶段篇">我为什么写博客（一）：阶段篇</a> (10)</li><li>2009年06月25日 -- <a href="http://blogunion.org/log/jiehunla.html" title="结婚啦:)">结婚啦:)</a> (153)</li><li>2006年12月05日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/hemes-dot-blogflux-dot-com.html" title="wordpress模版网站收集之themes.blogflux.com：135款wordpress模版免费下载">wordpress模版网站收集之themes.blogflux.com：135款wordpress模版免费下载</a> (1)</li><li>2007年10月22日 -- <a href="http://blogunion.org/reading/blog-died.html" title="读者推荐：博客的死因">读者推荐：博客的死因</a> (8)</li><li>2007年08月01日 -- <a href="http://blogunion.org/blogging-tips/category-writing-tips.html" title="博客分类标题的写作技巧">博客分类标题的写作技巧</a> (14)</li><li>2007年08月09日 -- <a href="http://blogunion.org/marketing/time-for-posting.html" title="在最合适的时间发布最合适的内容">在最合适的时间发布最合适的内容</a> (14)</li><li>2008年01月14日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/22-premium-themes.html" title="推荐22款WordPress Premium Themes">推荐22款WordPress Premium Themes</a> (7)</li><li>2009年05月05日 -- <a href="http://blogunion.org/blogs/chuangye03.html" title="一个未创业者的创业谈：创业者应该看的N个中文博客">一个未创业者的创业谈：创业者应该看的N个中文博客</a> (12)</li><li>2007年07月08日 -- <a href="http://blogunion.org/problogger/blog-co-and-seo.html" title="独立博客之旅六，博客优化推广篇">独立博客之旅六，博客优化推广篇</a> (33)</li><li>2009年04月18日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/author-exposed.html" title="Author Exposed，显示作者相关信息的wordpress插件">Author Exposed，显示作者相关信息的wordpress插件</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-plugins/3-plugins-for-hiding-post-from-wordpress.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>推荐六款适合做小说阅读站及小说下载站的wordpress 模板</title>
		<link>http://blogunion.org/wordpress/wordpress-themes/six-novel-theme.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-themes/six-novel-theme.html#comments</comments>
		<pubDate>Sat, 06 Aug 2011 08:48:27 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress模板]]></category>
		<category><![CDATA[小说模板]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1229</guid>
		<description><![CDATA[现在网络小说的受众越来越多，网络小说阅读网站以及网络小说下载站也越来越多。因此在这里推荐六款这方面的wordpress 模板，有兴趣的朋友可以参考下。 其实这些模板同时也适合那里做图片... ]]></description>
			<content:encoded><![CDATA[<p>现在网络小说的受众越来越多，网络小说阅读网站以及网络小说下载站也越来越多。因此在这里推荐六款这方面的wordpress 模板，有兴趣的朋友可以参考下。</p>
<p>其实这些模板同时也适合那里做图片网站，可以参考<a href="http://blogunion.org/wordpress/wordpress-themes/31-free-wordpress-photo-themes.html" target="_blank">31款免费WordPress图片模板</a>一文。当然，这两类模板其实还是有一些细微的区别。网络小说的封面是竖长条形，而图片站的模板大多是宽长条形。</p>
<h3>第一类小说站wordpress模板：纯图片型</h3>
<p>适合杂志类， 尤其是视觉效果艳丽的杂志，以及网络小说。</p>
<p><strong>Critical</strong></p>
<p><a href="http://themehybrid.com/demo/critical" target="_blank">演示站点</a> | <a href="http://themehybrid.com/themes/critical" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/critical-theme.png" alt="" title="critical-theme" width="300" height="303" class="aligncenter size-full wp-image-1230" /></a></p>
<p><strong>Quik Gallery Free WordPress Theme</strong></p>
<p><a href="http://www.aoclarkejr.com/themes/quik-gallery/" target="_blank">演示站点</a> | <a href="http://www.wpexplorer.com/quik-gallery-wordpress-theme.html" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/Quik-Gallery.png" alt="" title="Quik Gallery" width="450" height="450" class="aligncenter size-full wp-image-1232" /></a></p>
<p><strong>Paragrams Free WordPress Theme</strong></p>
<p><a href="http://wpshower.com/demo/?theme=paragrams" target="_blank">演示站点1</a> | <a href="http://www.fuckpdf.com" target="_blank">演示站点2</a> | <a href="http://wpshower.com/themes/paragrams/" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/paragramns-theme.png" alt="" title="paragramns-theme" width="420" height="506" class="aligncenter size-full wp-image-1231" /></a></p>
<h3>第一类小说站wordpress模板：图文并茂型</h3>
<p>适合网络小说，尤其是简介很出彩的网络小说。</p>
<p><strong>Retro-fitted wordpress theme</strong></p>
<p><a href="http://locallylost.com/retro-fitted" target="_blank">演示站点</a> | <a href="http://themehybrid.com/themes/retro-fitted" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/retro-fitted.png" alt="" title="retro-fitted" width="450" height="313" class="aligncenter size-full wp-image-1233" /></a></p>
<p><strong>Shadows Free Minimal WordPress Theme</strong></p>
<p><a href="http://www.mogupo.com" target="_blank">演示站点1</a> | <a href="http://www.aoclarkejr.com/themes/shadows/" target="_blank">演示站点2</a> | <a href="http://www.wpexplorer.com/shadows-wordpress-theme.html" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/Shadows.jpg" alt="" title="Shadows" width="450" height="450" class="aligncenter size-full wp-image-1234" /></a></p>
<p>wpbus-D4 wordpress theme</p>
<p><a href="http://www.wpbus.com/?p=176" target="_blank">下载链接</a></p>
<p><a href="http://blogunion.org/"><img src="http://blogunion.org/wp-content/uploads/2011/08/wpbus-D4.jpg" alt="" title="wpbus-D4" width="550" height="925" class="aligncenter size-full wp-image-1235" /></a></p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2008年12月19日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/9-grid-layout-wordpress-themes.html" title=" 推荐9款网格风格wordpress模板"> 推荐9款网格风格wordpress模板</a> (10)</li><li>2008年12月18日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/4-wordpress-themes.html" title="推荐四款免费漂亮的wordpress模板">推荐四款免费漂亮的wordpress模板</a> (9)</li><li>2008年03月25日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/9-125x125-ready-wordpress-themes.html" title="推荐11款含125*125广告位的 wordpress 模板">推荐11款含125*125广告位的 wordpress 模板</a> (17)</li><li>2008年01月29日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/branford-magazine-theme-tutorial.html" title="Branford Magazine模板简明使用教程">Branford Magazine模板简明使用教程</a> (15)</li><li>2008年01月22日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/8-photoblog-themes.html" title="推荐8款wordpress图片模板">推荐8款wordpress图片模板</a> (7)</li><li>2007年09月20日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/how-to-choose.html" title="如何选择一款理想的wordpress模板？">如何选择一款理想的wordpress模板？</a> (27)</li><li>2007年08月11日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/theme-tutorial.html" title="在线定制个性化的wordpress模板">在线定制个性化的wordpress模板</a> (14)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-themes/six-novel-theme.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>28个非常有用的WordPress 主题函数使用技巧（4）</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-4.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-4.html#comments</comments>
		<pubDate>Tue, 15 Jun 2010 13:45:36 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[WordPress 主题函数]]></category>
		<category><![CDATA[WordPress 函数]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1210</guid>
		<description><![CDATA[接前3篇： 28个非常有用的WordPress 主题函数使用技巧（1） 28个非常有用的WordPress 主题函数使用技巧（2） 28个非常有用的WordPress 主题函数使用技巧（3） 注：本文提到的代码均必须加到 functions.p... ]]></description>
			<content:encoded><![CDATA[<p>接前3篇：</p>
<p><a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（1）</a></p>
<p><a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（2）</a></p>
<p><a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-3.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（3）</a></p>
<p>注：本文提到的代码均必须加到 functions.php 文件里面。注意代码里面涉及到网址，邮件等内容可以自行替换。</p>
<p><strong>22，启用paypal 捐赠简码</strong></p>
<p>当你写完一篇以后，可以在文章里面插入paypal 捐赠按钮，方便读者捐赠。以下的代码可以让你非常轻松的做到这一点。</p>
<div class="hl-surround"><div class="hl-main">function donate_shortcode( $atts ) {<br />&nbsp;&nbsp; &nbsp;extract(shortcode_atts(array(<br />&nbsp;&nbsp; &nbsp;'text' =&gt; 'Make a donation',<br />&nbsp;&nbsp; &nbsp;'account' =&gt; 'REPLACE ME',<br />&nbsp;&nbsp; &nbsp;'for' =&gt; '',<br />&nbsp;&nbsp; &nbsp;), $atts));<br /><br />&nbsp;&nbsp; &nbsp;global $post;<br /><br />&nbsp;&nbsp; &nbsp;if (!$for) $for = str_replace(&quot; &quot;,&quot; &quot;,$post-&gt;post_title);<br /><br />&nbsp;&nbsp; &nbsp;return '&lt;a class=&quot;donateLink&quot; href=&quot;https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business='.$account.'&amp;item_name=Donation for '.$for.'&quot;&gt;'.$text.'&lt;/a&gt;';<br /><br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_shortcode('donate', 'donate_shortcode');</div></div>
<p><strong>23，设定文章从发布到出现在RSS中的时间长短</strong></p>
<p>通过RSS订阅来阅读博文的朋友可能都会有这个体验：经常发现RSS中的文字或者细节有错误，而返回到页面的时候却发现错误已经没有了。这种情况最有可能是因为</p>
<p>RSS最大的好处是快捷、直接，但这个最大的好处有时候对作者来说却会引发某些尴尬。所以，有时候有必要让文章发布后到读者从RSS中按到有一个小小的时间差，方便作者排查某些问题。以下的代码可以做到以下几点：</p>
<div class="hl-surround"><div class="hl-main">function publish_later_on_feed($where) {<br />&nbsp;&nbsp; &nbsp;global $wpdb;<br /><br />&nbsp;&nbsp; &nbsp;if ( is_feed() ) {<br />&nbsp;&nbsp; &nbsp;// timestamp in WP-format<br />&nbsp;&nbsp; &nbsp;$now = gmdate(‘Y-m-d H:i:s’);<br /><br />&nbsp;&nbsp; &nbsp;// value for wait; + device<br />&nbsp;&nbsp; &nbsp;$wait = ‘10′; // integer<br /><br />&nbsp;&nbsp; &nbsp;// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff<br />&nbsp;&nbsp; &nbsp;$device = ‘MINUTE’; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR<br /><br />&nbsp;&nbsp; &nbsp;// add SQL-sytax to default $where<br />&nbsp;&nbsp; &nbsp;$where .= ” AND TIMESTAMPDIFF($device, $wpdb-&gt;posts.post_date_gmt, ‘$now’) &gt; $wait “;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;return $where;<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;add_filter(‘posts_where’, ‘publish_later_on_feed’);</div></div>
<p>这段代码设置的时间是10分钟，你可以把10改成任何你想要的时间。</p>
<p><strong>24，自定义摘要输出时的符号</strong></p>
<p>一般设定自动摘要输出，你会经常在WordPress博客的首页看到“[...]”这样的符号。为了界面的美观，或者是个性化的需要，你可以把这个默认的符号改变为其他的符号。而以下的代码就是为了实现这个而写：</p>
<div class="hl-surround"><div class="hl-main">// custom excerpt ellipses for 2.9<br />&nbsp;&nbsp; &nbsp;function custom_excerpt_more($more) {<br />&nbsp;&nbsp; &nbsp;return '…';<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('excerpt_more', 'custom_excerpt_more');<br /><br />&nbsp;&nbsp; &nbsp;/* custom excerpt ellipses for 2.8-<br />&nbsp;&nbsp; &nbsp;function custom_excerpt_more($excerpt) {<br />&nbsp;&nbsp; &nbsp;return str_replace('[...]', '…', $excerpt);<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('wp_trim_excerpt', 'custom_excerpt_more');<br />&nbsp;&nbsp; &nbsp;*/</div></div>
<p><strong>25，自定义摘要输出的文字长度</strong></p>
<p>假如你比较懒，不想在撰写文章的时候每篇文章都输入摘要，就可以让系统自动截取一定长度的文字来作为摘要输出。下面的代码默认是100个字节，也就是50个汉字。你可以把数值修改成符合你需要的数字。</p>
<div class="hl-surround"><div class="hl-main">function new_excerpt_length($length) {<br />&nbsp;&nbsp; &nbsp;return 100;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('excerpt_length', 'new_excerpt_length');</div></div>
<p><strong>26，显示精确评论数</strong></p>
<p>WordPress默认是把trackbacks 和 pings 都算作评论的，因此当你设置不显示trackbacks 和 ping的时候，评论数看起来总是不对头。以下的代码则以让WordPress只计算评论的数量，而不把trackbacks 和 pings也计算进去。</p>
<div class="hl-surround"><div class="hl-main">add_filter('get_comments_number', 'comment_count', 0);<br />&nbsp;&nbsp; &nbsp;function comment_count( $count ) {<br />&nbsp;&nbsp; &nbsp;if ( ! is_admin() ) {<br />&nbsp;&nbsp; &nbsp;global $id;<br />&nbsp;&nbsp; &nbsp;$comments_by_type = &amp;separate_comments(get_comments('status=approve&amp;post_id=' . $id));<br />&nbsp;&nbsp; &nbsp;return count($comments_by_type['comment']);<br />&nbsp;&nbsp; &nbsp;} else {<br />&nbsp;&nbsp; &nbsp;return $count;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p><strong>27，取消RSS输出</strong></p>
<p>对于某些博客而言，或者因为被太多人采集了，或者因为不想让别人通过RSS订阅，想取消RSS输出。WordPress默认是没有这个功能的，但你可以通过以下的代码来取消RSS输出。</p>
<div class="hl-surround"><div class="hl-main">function fb_disable_feed() {<br />&nbsp;&nbsp; &nbsp;wp_die( __('No feed available,please visit our &lt;a href=&quot;'. get_bloginfo('url') .'&quot;&gt;homepage&lt;/a&gt;!') );<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;add_action('do_feed', 'fb_disable_feed', 1);<br />&nbsp;&nbsp; &nbsp;add_action('do_feed_rdf', 'fb_disable_feed', 1);<br />&nbsp;&nbsp; &nbsp;add_action('do_feed_rss', 'fb_disable_feed', 1);<br />&nbsp;&nbsp; &nbsp;add_action('do_feed_rss2', 'fb_disable_feed', 1);<br />&nbsp;&nbsp; &nbsp;add_action('do_feed_atom', 'fb_disable_feed', 1);</div></div>
<p><strong>28，显示Twitter 的订阅数以及其他资料</strong></p>
<p>Twitter系统以及很多第三方的客户端都可以让你在WordPress博客的侧边栏暂时Twitter的订阅数以及一些其他的资料。这种做法往往很多时候都没办法跟博客已有的界面结合的很好。而以下的代码则可以让你自定义Twitter 在博客上的显示外观。</p>
<div class="hl-surround"><div class="hl-main">function rarst_twitter_user( $username, $field, $display = false ) {<br />&nbsp;&nbsp; &nbsp;$interval = 3600;<br />&nbsp;&nbsp; &nbsp;$cache = get_option('rarst_twitter_user');<br />&nbsp;&nbsp; &nbsp;$url = 'http://api.twitter.com/1/users/show.json?screen_name='.urlencode($username);<br /><br />&nbsp;&nbsp; &nbsp;if ( false == $cache )<br />&nbsp;&nbsp; &nbsp;$cache = array();<br /><br />&nbsp;&nbsp; &nbsp;// if first time request add placeholder and force update<br />&nbsp;&nbsp; &nbsp;if ( !isset( $cache[$username][$field] ) ) {<br />&nbsp;&nbsp; &nbsp;$cache[$username][$field] = NULL;<br />&nbsp;&nbsp; &nbsp;$cache[$username]['lastcheck'] = 0;<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;// if outdated<br />&nbsp;&nbsp; &nbsp;if( $cache[$username]['lastcheck'] &lt; (time()-$interval) ) {<br /><br />&nbsp;&nbsp; &nbsp;// holds decoded JSON data in memory<br />&nbsp;&nbsp; &nbsp;static $memorycache;<br /><br />&nbsp;&nbsp; &nbsp;if ( isset($memorycache[$username]) ) {<br />&nbsp;&nbsp; &nbsp;$data = $memorycache[$username];<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;else {<br />&nbsp;&nbsp; &nbsp;$result = wp_remote_retrieve_body(wp_remote_request($url));<br />&nbsp;&nbsp; &nbsp;$data = json_decode( $result );<br />&nbsp;&nbsp; &nbsp;if ( is_object($data) )<br />&nbsp;&nbsp; &nbsp;$memorycache[$username] = $data;<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;if ( is_object($data) ) {<br />&nbsp;&nbsp; &nbsp;// update all fields, known to be requested<br />&nbsp;&nbsp; &nbsp;foreach ($cache[$username] as $key =&gt; $value)<br />&nbsp;&nbsp; &nbsp;if( isset($data-&gt;$key) )<br />&nbsp;&nbsp; &nbsp;$cache[$username][$key] = $data-&gt;$key;<br /><br />&nbsp;&nbsp; &nbsp;$cache[$username]['lastcheck'] = time();<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;else {<br />&nbsp;&nbsp; &nbsp;$cache[$username]['lastcheck'] = time()+60;<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;update_option( 'rarst_twitter_user', $cache );<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;if ( false != $display )<br />&nbsp;&nbsp; &nbsp;echo $cache[$username][$field];<br />&nbsp;&nbsp; &nbsp;return $cache[$username][$field];<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p>把上面的代码复制到 functions.php后，再把下面代码复制到你想出现的地方即可。<br />
Then place the following code where you want to display the count in your theme file:</p>
<div class="hl-surround"><div class="hl-main">echo rarst_twitter_user('wpbeginner', 'name').' has '.<br />&nbsp;&nbsp; &nbsp;rarst_twitter_user('wpbeginner', 'followers_count').' followers after '.<br />&nbsp;&nbsp; &nbsp;rarst_twitter_user('wpbeginner', 'statuses_count').' updates.';</div></div>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年06月12日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-3.html" title="28个非常有用的WordPress 主题函数使用技巧（3）">28个非常有用的WordPress 主题函数使用技巧（3）</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-4.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>28个非常有用的WordPress 主题函数使用技巧（3）</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-3.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-3.html#comments</comments>
		<pubDate>Sat, 12 Jun 2010 15:37:40 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[WordPress functions]]></category>
		<category><![CDATA[WordPress 主题函数]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1208</guid>
		<description><![CDATA[接前两篇： 28个非常有用的WordPress 主题函数使用技巧（1） 28个非常有用的WordPress 主题函数使用技巧（1） 注：本文提到的代码均必须加到 functions.php 文件里面。注意代码里面涉及到网址，邮件... ]]></description>
			<content:encoded><![CDATA[<p>接前两篇：</p>
<p><a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（1）</a></p>
<p><a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（1）</a></p>
<p>注：本文提到的代码均必须加到 functions.php 文件里面。注意代码里面涉及到网址，邮件等内容可以自行替换。</p>
<p><strong>15，优化Wordpress 博客的RSS</strong></p>
<p>如何在RSS里面加入版权链接？如何在RSS加入广告？针对国内互联网的现状，在RSS里面加入版权尤为重要，广告倒是次要的。</p>
<p>除了插件（Better Feed）以外，可以采用以下的方法来实现。</p>
<div class="hl-surround"><div class="hl-main">function wpbeginner_postrss($content) {<br />&nbsp;&nbsp; &nbsp;if(is_feed()){<br />&nbsp;&nbsp; &nbsp;$content = 'This post was written by Syed Balkhi '.$content.'Check out WPBeginner';<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;return $content;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('the_excerpt_rss', 'wpbeginner_postrss');<br />&nbsp;&nbsp; &nbsp;add_filter('the_content', 'wpbeginner_postrss');</div></div>
<p><strong>16，给RSS添加缩略图</strong></p>
<p>缩略图一般是在正常的博客页面上用来起到美化界面的作用。当然，如果需要的话，也可以给RSS内容增加一个缩略图。要做到这一点，只需要在functions.php 里面加入如下代码：</p>
<div class="hl-surround"><div class="hl-main">function rss_post_thumbnail($content) {<br />&nbsp;&nbsp; &nbsp;global $post;<br />&nbsp;&nbsp; &nbsp;if(has_post_thumbnail($post-&gt;ID)) {<br />&nbsp;&nbsp; &nbsp;$content = '&lt;p&gt;' . get_the_post_thumbnail($post-&gt;ID) .<br />&nbsp;&nbsp; &nbsp;'&lt;/p&gt;' . get_the_content();<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;return $content;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('the_excerpt_rss', 'rss_post_thumbnail');<br />&nbsp;&nbsp; &nbsp;add_filter('the_content_feed', 'rss_post_thumbnail');</div></div>
<p><strong>17，开启WordPress评论嵌套功能。</strong></p>
<p>评论嵌套功能是WordPress自身带有的最好功能之一，只可惜很多WordPress模板都不支持。很多文章都有提到过修改的方法，但一般都涉及到修改comments文件和header文件。事实上，通过修改functions.php文件来修改是最简便的，而且一劳永逸。</p>
<div class="hl-surround"><div class="hl-main">// enable threaded comments<br />&nbsp;&nbsp; &nbsp;function enable_threaded_comments(){<br />&nbsp;&nbsp; &nbsp;if (!is_admin()) {<br />&nbsp;&nbsp; &nbsp;if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))<br />&nbsp;&nbsp; &nbsp;wp_enqueue_script('comment-reply');<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_action('get_header', 'enable_threaded_comments');</div></div>
<p><strong>18，移除WordPress登陆面板的错误提示</strong></p>
<p>当你输入的密码或者用户名错误的时候，WordPress登陆界面会给出相应的提示。但如果碰到黑客的话，这些提示反而给了他们更好的提示，让他们更容易破解用户名和密码。因此，处于安全性考虑，移除WordPress登陆面板的错误提示是非常必要的。</p>
<div class="hl-surround"><div class="hl-main">add_filter('login_errors',create_function('$a', &quot;return null;&quot;));</div></div>
<p><strong>19，关闭WordPress的搜索功能</strong></p>
<p>当把WordPress当做CMS系统来使用的时候，WordPress自带的搜索功能实用性就不是太强了。一来增加数据库查询次数，二来Google 自定义搜索会是更好的替代。因此，你只需要通过以下的代码就可以关闭WordPress的搜索功能。</p>
<div class="hl-surround"><div class="hl-main">function fb_filter_query( $query, $error = true ) {<br /><br />&nbsp;&nbsp; &nbsp;if ( is_search() ) {<br />&nbsp;&nbsp; &nbsp;$query-&gt;is_search = false;<br />&nbsp;&nbsp; &nbsp;$query-&gt;query_vars[s] = false;<br />&nbsp;&nbsp; &nbsp;$query-&gt;query[s] = false;<br /><br />&nbsp;&nbsp; &nbsp;// to error<br />&nbsp;&nbsp; &nbsp;if ( $error == true )<br />&nbsp;&nbsp; &nbsp;$query-&gt;is_404 = true;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;add_action( 'parse_query', 'fb_filter_query' );<br />&nbsp;&nbsp; &nbsp;add_filter( 'get_search_form', create_function( '$a', &quot;return null;&quot; ) );</div></div>
<p><strong>20，启用WordPress简码功能</strong></p>
<p>Google AdSense 算是博客的标配之一了，很多CMS经常会在模板选项里面预置Google AdSense的广告位。假如你的模板不支持，你可以通过以下的方法来解决：</p>
<div class="hl-surround"><div class="hl-main">function showads() {<br />&nbsp;&nbsp; &nbsp;return '&lt;div id=&quot;adsense&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;&lt;!–<br />&nbsp;&nbsp; &nbsp;google_ad_client = &quot;pub-XXXXXXXXXXXXXX&quot;;<br />&nbsp;&nbsp; &nbsp;google_ad_slot = &quot;4668915978&quot;;<br />&nbsp;&nbsp; &nbsp;google_ad_width = 468;<br />&nbsp;&nbsp; &nbsp;google_ad_height = 60;<br />&nbsp;&nbsp; &nbsp;//–&gt;<br />&nbsp;&nbsp; &nbsp;&lt;/script&gt;<br /><br />&nbsp;&nbsp; &nbsp;&lt;script type=&quot;text/javascript&quot;<br />&nbsp;&nbsp; &nbsp;src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;<br />&nbsp;&nbsp; &nbsp;&lt;/script&gt;&lt;/div&gt;';<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;add_shortcode('adsense', 'showads');</div></div>
<p>21，不通过.htaccess将rss地址唯一化</p>
<p>WordPress本身提供好几个不同版本的rss地址，加入你又使用了FeedBurner或者feedsky的话，RSS地址就会更多。太多的RSS容易分流订阅客户，而且也不利于品牌推广。</p>
<p>一般的修改方法是通过更改.htaccess来进行，此外，还可以通过以下的代码来实现。</p>
<div class="hl-surround"><div class="hl-main">function custom_feed_link($output, $feed) {<br /><br />&nbsp;&nbsp; &nbsp;$feed_url = 'http://feeds.feedburner.com/wpbeginner';<br /><br />&nbsp;&nbsp; &nbsp;$feed_array = array('rss' =&gt; $feed_url, 'rss2' =&gt; $feed_url, 'atom' =&gt; $feed_url, 'rdf' =&gt; $feed_url, 'comments_rss2' =&gt; '');<br />&nbsp;&nbsp; &nbsp;$feed_array[$feed] = $feed_url;<br />&nbsp;&nbsp; &nbsp;$output = $feed_array[$feed];<br /><br />&nbsp;&nbsp; &nbsp;return $output;<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;function other_feed_links($link) {<br /><br />&nbsp;&nbsp; &nbsp;$link = 'http://feeds.feedburner.com/wpbeginner';<br />&nbsp;&nbsp; &nbsp;return $link;<br /><br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;//Add our functions to the specific filters<br />&nbsp;&nbsp; &nbsp;add_filter('feed_link','custom_feed_link', 1, 2);<br />&nbsp;&nbsp; &nbsp;add_filter('category_feed_link', 'other_feed_links');<br />&nbsp;&nbsp; &nbsp;add_filter('author_feed_link', 'other_feed_links');<br />&nbsp;&nbsp; &nbsp;add_filter('tag_feed_link','other_feed_links');<br />&nbsp;&nbsp; &nbsp;add_filter('search_feed_link','other_feed_links');</div></div>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年06月15日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-4.html" title="28个非常有用的WordPress 主题函数使用技巧（4）">28个非常有用的WordPress 主题函数使用技巧（4）</a> (12)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-3.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>28个非常有用的WordPress 主题函数使用技巧（2）</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html#comments</comments>
		<pubDate>Wed, 09 Jun 2010 02:17:24 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[WordPress主题函数]]></category>
		<category><![CDATA[WordPress函数]]></category>
		<category><![CDATA[WordPress技巧]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1206</guid>
		<description><![CDATA[接上篇：28个非常有用的WordPress 主题函数使用技巧（1） 原文25+ Extremely Useful Tricks for the WordPress Functions File非常长，博客联盟将会分成四篇来发。 8，让WordPress底部的版权时间显示的更生动 很多... ]]></description>
			<content:encoded><![CDATA[<p>接上篇：<a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（1）</a></p>
<p>原文<a href="http://www.wpbeginner.com/wp-tutorials/25-extremely-useful-tricks-for-the-wordpress-functions-file/" target="_blank">25+ Extremely Useful Tricks for the WordPress Functions File</a>非常长，<a href="http://blogunion.org/">博客联盟</a>将会分成四篇来发。</p>
<p><strong>8，让WordPress底部的版权时间显示的更生动</strong></p>
<p>很多网站的版权时间都显示的是建站时的年份，有些则是显示当下的年份。事实上，这两种方式都不是太好。</p>
<p>最好的方式是显示从网站建设之初的年份到目前的年份位置，类似© 2006 – 2010这种显示方式。</p>
<p>这种效果通过以下的代码可以实现。添加完下面的代码后，系统会自动抓取发布第一篇文章的年份以及最新一篇文章的年份，并把它显示出来。</p>
<div class="hl-surround"><div class="hl-main">function comicpress_copyright() {<br />&nbsp;&nbsp; &nbsp;global $wpdb;<br />&nbsp;&nbsp; &nbsp;$copyright_dates = $wpdb-&gt;get_results(&quot;<br />&nbsp;&nbsp; &nbsp;SELECT<br />&nbsp;&nbsp; &nbsp;YEAR(min(post_date_gmt)) AS firstdate,<br />&nbsp;&nbsp; &nbsp;YEAR(max(post_date_gmt)) AS lastdate<br />&nbsp;&nbsp; &nbsp;FROM<br />&nbsp;&nbsp; &nbsp;$wpdb-&gt;posts<br />&nbsp;&nbsp; &nbsp;WHERE<br />&nbsp;&nbsp; &nbsp;post_status = 'publish'<br />&nbsp;&nbsp; &nbsp;&quot;);<br />&nbsp;&nbsp; &nbsp;$output = '';<br />&nbsp;&nbsp; &nbsp;if($copyright_dates) {<br />&nbsp;&nbsp; &nbsp;$copyright = &quot;&amp;copy; &quot; . $copyright_dates[0]-&gt;firstdate;<br />&nbsp;&nbsp; &nbsp;if($copyright_dates[0]-&gt;firstdate != $copyright_dates[0]-&gt;lastdate) {<br />&nbsp;&nbsp; &nbsp;$copyright .= '-' . $copyright_dates[0]-&gt;lastdate;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;$output = $copyright;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;return $output;<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p>把上面的代码添加到了functions.php文件里面后，还需要在 footer.php 任何你想显示版权时间的地方加上如下代码：</p>
<div class="hl-surround"><div class="hl-main">&lt;?php echo comicpress_copyright(); ?&gt;</div></div>
<p><strong>9，给读者投稿文章添加姓名/来源</strong></p>
<p>如果你的博客接受读者的投稿，想在该篇文章出现投稿者的姓名，同时又不想通过添加作者的这种繁琐而麻烦的方式来操作，则可以使用下面的代码。使用下面的代码后，只需要在撰写文章的时候在自定义区域填上投稿者的姓名即可。系统会自动将发布者的名称换成投稿者的名称。</p>
<p>这个代码对接受读者投稿较多的网站，或者是资讯型的网站非常有用（利用它来显示来源）。</p>
<div class="hl-surround"><div class="hl-main">add_filter( 'the_author', 'guest_author_name' );<br />&nbsp;&nbsp; &nbsp;add_filter( 'get_the_author_display_name', 'guest_author_name' );<br /><br />&nbsp;&nbsp; &nbsp;function guest_author_name( $name ) {<br />&nbsp;&nbsp; &nbsp;global $post;<br /><br />&nbsp;&nbsp; &nbsp;$author = get_post_meta( $post-&gt;ID, 'guest-author', true );<br /><br />&nbsp;&nbsp; &nbsp;if ( $author )<br />&nbsp;&nbsp; &nbsp;$name = $author;<br /><br />&nbsp;&nbsp; &nbsp;return $name;<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p><strong>10，启用文章缩略图功能</strong></p>
<p>从WordPress2.9版本开始，可以给模板添加文章缩略图功能。操作方法很简单，只需要把下面的代码添加到functions.php里面。</p>
<div class="hl-surround"><div class="hl-main">add_theme_support( 'post-thumbnails' );</div></div>
<p>然后在要显示缩略图的地方放置下面的代码即可。</p>
<div class="hl-surround"><div class="hl-main">&lt;?php the_post_thumbnail(); ?&gt;</div></div>
<p><strong>11，自定义WordPress 3.0 版本导航栏</strong></p>
<p>WordPress 3.0 增加了一个功能，可以让WordPress模板开发者自定义导航菜单。如果你想给用户一个导航栏的选择权，只需要把下面的代码加入到 functions.php 文件里面。</p>
<div class="hl-surround"><div class="hl-main">add_theme_support( 'nav-menus' );</div></div>
<p>之后把下面的代码复制到你想出新的地方：</p>
<div class="hl-surround"><div class="hl-main">&lt;?php wp_nav_menu( array( 'sort_column' =&gt; 'menu_order', 'container_class' =&gt; 'menu-header' ) ); ?&gt;</div></div>
<p><strong>12，移除WordPress默认的个人资料选项</strong></p>
<p>如果你客户的想让用户可以自行添加个人资料，那么需要让这个选项更简单。其中一个方法就是移除部分选项，AIM, Yahoo IM 和 Jabber 之类的东东。</p>
<div class="hl-surround"><div class="hl-main">add_filter('user_contactmethods','hide_profile_fields',10,1);<br /><br />&nbsp;&nbsp; &nbsp;function hide_profile_fields( $contactmethods ) {<br />&nbsp;&nbsp; &nbsp;unset($contactmethods['aim']);<br />&nbsp;&nbsp; &nbsp;unset($contactmethods['jabber']);<br />&nbsp;&nbsp; &nbsp;unset($contactmethods['yim']);<br />&nbsp;&nbsp; &nbsp;return $contactmethods;<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p><strong>13，添加作者个人资料选项</strong></p>
<p>如果你想更充分的展示作者的个人资料，那么你可以添加一些更个性化的资料选项，例如添加twitter 和 facebook账号等。下面的代码就是添加twitter 和 facebook账号用的。当然，你可以把里面的内容替换成其他任何你想展示的资料。这个对多博客作者尤其有用。</p>
<div class="hl-surround"><div class="hl-main">function my_new_contactmethods( $contactmethods ) {<br />&nbsp;&nbsp; &nbsp;// Add Twitter<br />&nbsp;&nbsp; &nbsp;$contactmethods['twitter'] = 'Twitter';<br />&nbsp;&nbsp; &nbsp;//add Facebook<br />&nbsp;&nbsp; &nbsp;$contactmethods['facebook'] = 'Facebook';<br /><br />&nbsp;&nbsp; &nbsp;return $contactmethods;<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('user_contactmethods','my_new_contactmethods',10,1);</div></div>
<p>添加完是上面的代码后，你需要在author.php文件里面添加如下的代码：</p>
<div class="hl-surround"><div class="hl-main">&lt;?php echo $curauth-&gt;twitter; ?&gt;</div></div>
<p>注意：改代码仅在WordPress2.9以上的版本起作用。</p>
<p><strong>14，添加侧边栏小模块</strong></p>
<p>这是目前用的最多的技巧之一，很多WordPress模板开发者都已经知道，并且在用了。</p>
<div class="hl-surround"><div class="hl-main">if ( function_exists('register_sidebar') )<br />&nbsp;&nbsp; &nbsp;register_sidebar(array('name'=&gt;'MiddleSidebar',<br />&nbsp;&nbsp; &nbsp;'before_widget' =&gt; '&lt;li class=&quot;widget&quot;&gt;',<br />&nbsp;&nbsp; &nbsp;'after_widget' =&gt; '&lt;/li&gt;',<br />&nbsp;&nbsp; &nbsp;'before_title' =&gt; '&lt;h2 class=&quot;widgettitle&quot;&gt;',<br />&nbsp;&nbsp; &nbsp;'after_title' =&gt; '&lt;/h3&gt;',<br />&nbsp;&nbsp; &nbsp;));<br />&nbsp;&nbsp; &nbsp;register_sidebar(array('name'=&gt;'FooterSidebar',<br />&nbsp;&nbsp; &nbsp;'before_widget' =&gt; '&lt;li class=&quot;widget&quot;&gt;',<br />&nbsp;&nbsp; &nbsp;'after_widget' =&gt; '&lt;/li&gt;',<br />&nbsp;&nbsp; &nbsp;'before_title' =&gt; '&lt;h2 class=&quot;widgettitle&quot;&gt;',<br />&nbsp;&nbsp; &nbsp;'after_title' =&gt; '&lt;/h3&gt;',<br />&nbsp;&nbsp; &nbsp;));</div></div>
<p>上面的代码可以增加两个侧边栏的小模块。以此类推，你可以添加无限多侧边栏的小模块。添加完上面的代码后，你需要把下面的代码添加到你要出现这边小模块的地方。</p>
<div class="hl-surround"><div class="hl-main">&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('MiddleSidebar') ) : ?&gt;<br />&nbsp;&nbsp; &nbsp;&lt;!–Default sidebar info goes here–&gt;<br />&nbsp;&nbsp; &nbsp;&lt;?php endif; ?&gt;</div></div>
<p>注意：侧边栏并不一定需要出现在sidebar.php文件里面。</p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年06月08日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html" title="28个非常有用的WordPress 主题函数使用技巧（1）">28个非常有用的WordPress 主题函数使用技巧（1）</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>28个非常有用的WordPress 主题函数使用技巧（1）</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html#comments</comments>
		<pubDate>Tue, 08 Jun 2010 15:15:28 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[WordPress主题函数]]></category>
		<category><![CDATA[WordPress函数]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1205</guid>
		<description><![CDATA[WordPress主题一般有一系列的php文件和一个style. css文件，而其中功能最为强大的文件则是functions. php。WordPress 有非常多的常用函数，你可以通过添加和删除一些函数来增加WordPress主题的功能，而... ]]></description>
			<content:encoded><![CDATA[<p>WordPress主题一般有一系列的php文件和一个style. css文件，而其中功能最为强大的文件则是functions. php。WordPress 有非常多的常用函数，你可以通过添加和删除一些函数来增加WordPress主题的功能，而不需要修改任何的主题文件。</p>
<p>本文的目标读者是WordPress 主题开发者，需要懂一些基本的PHP知识。另，下文提到的所有代码都必须添加到functions. php文件里面。</p>
<p>博客联盟注：原文很长，将分成好几篇来发。</p>
<p><strong>1，添加Google Analytics 统计</strong></p>
<p>只需要把下面的代码添加到functions. php文件里面——注意把里面的中文部分替换成你的Google 统计代码，然后你就不用担心了。</p>
<div class="hl-surround"><div class="hl-main">&lt;?php<br />&nbsp;&nbsp; &nbsp;add_action('wp_footer', 'add_googleanalytics');<br />&nbsp;&nbsp; &nbsp;function add_googleanalytics() { ?&gt;<br />&nbsp;&nbsp; &nbsp;// 把Google 统计代码复制到这里<br />&nbsp;&nbsp; &nbsp;&lt;?php } ?&gt;</div></div>
<p><strong>2，给WordPress 博客添加一个 Favicon 图标。</strong></p>
<p>每一个博客都应该有一个独一无二的标志，你可以通过添加代码到header.php来实现。当然，你也可以通过添加代码到functions.php来实现。添加完下面的代码后，只需要把Favicon.ico文件上传到网站根目录即可。</p>
<div class="hl-surround"><div class="hl-main">// add a favicon to your<br />&nbsp;&nbsp; &nbsp;function blog_favicon() {<br />&nbsp;&nbsp; &nbsp;echo '&lt;link rel=&quot;Shortcut Icon&quot; type=&quot;image/x-icon&quot; href=&quot;'.get_bloginfo('wpurl').'/favicon.ico&quot; /&gt;';<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_action('wp_head', 'blog_favicon');</div></div>
<p><strong>3，移除WordPress版本号。</strong></p>
<p>WordPress有新版本出来后，总会在后台提示管理员进行升级。但假如你是给客户制作网站，而他们又不想升级的话，最好的办法就是从WordPress 头部、RSS里面以及其他任何地方移除版本的信息。</p>
<div class="hl-surround"><div class="hl-main">function wpbeginner_remove_version() {<br />&nbsp;&nbsp; &nbsp;return '';<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;add_filter('the_generator', 'wpbeginner_remove_version');</div></div>
<p><strong>4，给WordPress控制面板添加自定义logo</strong></p>
<p>用WordPress给客户制作网站，如果给WordPress的控制面板后台添加一个自定义logo，则会让网站显的专业很多。要做到这一点，你只需要把代码添加到functions.php即可。</p>
<div class="hl-surround"><div class="hl-main">//hook the administrative header output<br />&nbsp;&nbsp; &nbsp;add_action('admin_head', 'my_custom_logo');<br /><br />&nbsp;&nbsp; &nbsp;function my_custom_logo() {<br />&nbsp;&nbsp; &nbsp;echo '<br />&nbsp;&nbsp; &nbsp;&lt;style type=&quot;text/css&quot;&gt;<br />&nbsp;&nbsp; &nbsp;#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.gif) !important; }<br />&nbsp;&nbsp; &nbsp;&lt;/style&gt;<br />&nbsp;&nbsp; &nbsp;';<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p><strong>5，改变WordPress后台控制面板底部信息</strong></p>
<p>如上所述，如果不想让客户知道网站是由WordPress制作，则可以修改WordPress控制面板底部的信息，只需要把下面的代码添加到 functions.php文件即可。</p>
<p>You can change the footer of your Free or Custom WordPress themes by adding the necessary links. Simply paste the following code:</p>
<div class="hl-surround"><div class="hl-main">function remove_footer_admin () {<br />&nbsp;&nbsp; &nbsp;echo 'Fueled by &lt;a href=&quot;http://www.wordpress.org&quot; target=&quot;_blank&quot;&gt;WordPress&lt;/a&gt; | Designed by &lt;a href=&quot;http://www.uzzz.net&quot; target=&quot;_blank&quot;&gt;Uzzz Productions&lt;/a&gt; | WordPress Tutorials: &lt;a href=&quot;http://www.wpbeginner.com&quot; target=&quot;_blank&quot;&gt;WPBeginner&lt;/a&gt;&lt;/p&gt;';<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;add_filter('admin_footer_text', 'remove_footer_admin');</div></div>
<p>注：代码里面的html部分可以修改。</p>
<p><strong>6，自定义WordPress控制面板模块</strong></p>
<p>一些WordPress插件会在控制面板那里添加一些模块来显示相应的信息，作为一个WordPress模板设计者，你也可以通过修改functions.php文件来实现这个功能。注意替换里面的相应信息。</p>
<div class="hl-surround"><div class="hl-main">add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');<br /><br />&nbsp;&nbsp; &nbsp;function my_custom_dashboard_widgets() {<br />&nbsp;&nbsp; &nbsp;global $wp_meta_boxes;<br /><br />&nbsp;&nbsp; &nbsp;wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');<br />&nbsp;&nbsp; &nbsp;}<br /><br />&nbsp;&nbsp; &nbsp;function custom_dashboard_help() {<br />&nbsp;&nbsp; &nbsp;echo '&lt;p&gt;Welcome to Custom Blog Theme! Need help? Contact the developer &lt;a href=&quot;mailto:yourusername@gmail.com&quot;&gt;here&lt;/a&gt;. For WordPress Tutorials visit: &lt;a href=&quot;http://www.wpbeginner.com&quot; target=&quot;_blank&quot;&gt;WPBeginner&lt;/a&gt;&lt;/p&gt;';<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p><strong>7，改变默认的 Gravatar 头像</strong></p>
<p>WordPress程序默认的 Gravatar 头像很不咋地，而且到处都是千篇一律的默认头像一点都无法体现独特性。你可以把以下代码添加到functions.php文件里面，然后记得把自定义的  Gravatar 头像上传到WordPress模板的images文件夹。</p>
<div class="hl-surround"><div class="hl-main">add_filter( 'avatar_defaults', 'newgravatar' );<br /><br />&nbsp;&nbsp; &nbsp;function newgravatar ($avatar_defaults) {<br />&nbsp;&nbsp; &nbsp;$myavatar = get_bloginfo('template_directory') . '/images/gravatar.gif';<br />&nbsp;&nbsp; &nbsp;$avatar_defaults[$myavatar] = &quot;WPBeginner&quot;;<br />&nbsp;&nbsp; &nbsp;return $avatar_defaults;<br />&nbsp;&nbsp; &nbsp;}</div></div>
<p>原文：<a href="http://www.wpbeginner.com/wp-tutorials/25-extremely-useful-tricks-for-the-wordpress-functions-file/" target="_blank">25+ Extremely Useful Tricks for the WordPress Functions File</a></p>
<p>翻译：<a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html" target="_blank">28个非常有用的WordPress 主题函数使用技巧（1）</a></p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年06月09日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks-2.html" title="28个非常有用的WordPress 主题函数使用技巧（2）">28个非常有用的WordPress 主题函数使用技巧（2）</a> (6)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/28-wordpress-functions-tricks.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>推荐两款 WordPress FLV 视频播放插件</title>
		<link>http://blogunion.org/wordpress/wordpress-plugins/2-flv-plugins.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-plugins/2-flv-plugins.html#comments</comments>
		<pubDate>Sat, 29 May 2010 14:51:05 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress插件]]></category>
		<category><![CDATA[flv插件]]></category>
		<category><![CDATA[WordPress flv]]></category>
		<category><![CDATA[视频插件]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1198</guid>
		<description><![CDATA[啥是FLV？先来一段百度百科的介绍： FLV 是FLASH VIDEO的简称，FLV流媒体格式是随着Flash MX的推出发展而来的视频格式。由于它形成的文件极小、加载速度极快，使得网络观看视频文件成为可能，... ]]></description>
			<content:encoded><![CDATA[<p>啥是FLV？先来一段百度百科的介绍：</p>
<blockquote><p>FLV 是FLASH VIDEO的简称，FLV流媒体格式是随着Flash MX的推出发展而来的视频格式。由于它形成的文件极小、加载速度极快，使得网络观看视频文件成为可能，它的出现有效地解决了视频文件导入Flash后，使导出的SWF文件体积庞大，不能在网络上很好的使用等缺点。</p>
<p>目前各在线视频网站均采用此视频格式。如新浪播客、六间房、56、优酷、土豆、酷6、youtube等，无一例外。FLV已经成为当前视频文件的主流格式。 </p></blockquote>
<p>俗话说，文字不如图片，图片不如视频。不想写长篇大论的时候，贴贴视频也不错。以下介绍两款WordPress FLV 视频插件，各有千秋，需要者自取。</p>
<p><strong><a href="http://wordpress.org/extend/plugins/flv-embed/" target="_blank">FLV Embed</a></strong></p>
<p>FLV Embed 可以让你非常快速的在WordPress 博客中插入 FLV 视频文件，同时支持自动生成视频列表地图——自动生成缩略图、标题名称和描述，用来做一个视频博客是个挺不错的选择。详细可参考<a href="http://www.channel-ai.com/blog/videofeed.xml" target="_blank">这个页面</a>。</p>
<p>FLV Embed WordPress 视频插件共被下载61,664次，评级为四星。</p>
<p><strong><a href="http://wordpress.org/extend/plugins/wordpress-video-plugin/" target="_blank">WordPress Video Plugin</a></strong></p>
<p>使用这个插件后可以非常方便的从支持的网站列表当中发布视频到WordPress博客中，基本上国外所有的知名不知名的视频网站都支持，具体列表<a href="http://wordpress.org/extend/plugins/wordpress-video-plugin/" target="_blank">见这里</a>。</p>
<p>WordPress Video Plugin共计下载144,485次，评级为四星半。</p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2006年11月15日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/how-to-change-your-blog-folders.html" title="如何更换 Wordpress 的访问目录">如何更换 Wordpress 的访问目录</a> (3)</li><li>2006年11月25日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/wp-cache.html" title="wordpress插件之wp-cache">wordpress插件之wp-cache</a> (10)</li><li>2007年01月26日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/some-basic-wordpress-shortcuts.html" title="wordpress的一些基本快捷键">wordpress的一些基本快捷键</a> (4)</li><li>2007年05月05日 -- <a href="http://blogunion.org/money/accept-quickly.html" title="博客赚钱技巧之下手要快">博客赚钱技巧之下手要快</a> (12)</li><li>2007年03月15日 -- <a href="http://blogunion.org/bsp/maslow-vs-bsp.html" title="马斯洛层次需求理论与BSP的发展">马斯洛层次需求理论与BSP的发展</a> (1)</li><li>2007年05月22日 -- <a href="http://blogunion.org/review-ads/help-the-children-on-yaolan-dot-com.html" title="摇篮网在线捐助系统：在线捐助那些需要帮助的孩子">摇篮网在线捐助系统：在线捐助那些需要帮助的孩子</a> (2)</li><li>2006年02月28日 -- <a href="http://blogunion.org/internet/what-is-news.html" title="什么情况下狗咬人是新闻，人咬狗不是新闻？">什么情况下狗咬人是新闻，人咬狗不是新闻？</a> (0)</li><li>2007年01月19日 -- <a href="http://blogunion.org/topic/what-do-you-blogging-for.html" title="博客专题（一）：为什么blogging？为钱，名还是兴趣？">博客专题（一）：为什么blogging？为钱，名还是兴趣？</a> (6)</li><li>2010年01月12日 -- <a href="http://blogunion.org/marketing/baidumen.html" title="彻头彻尾的骗局：从百度“被黑门”看room98.ir站长的野蛮事件营销">彻头彻尾的骗局：从百度“被黑门”看room98.ir站长的野蛮事件营销</a> (31)</li><li>2008年06月06日 -- <a href="http://blogunion.org/log/estyles-questions.html" title="参加Estyle兄的点名游戏">参加Estyle兄的点名游戏</a> (7)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-plugins/2-flv-plugins.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>下载赚钱利器之千脑网盘WordPress插件</title>
		<link>http://blogunion.org/wordpress/wordpress-plugins/qiannao-wordpress-plugin.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-plugins/qiannao-wordpress-plugin.html#comments</comments>
		<pubDate>Sat, 24 Apr 2010 01:26:07 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress插件]]></category>
		<category><![CDATA[下载赚钱]]></category>
		<category><![CDATA[千脑]]></category>
		<category><![CDATA[千脑WordPress插件]]></category>
		<category><![CDATA[千脑网盘]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1192</guid>
		<description><![CDATA[在去年九月，博客联盟介绍了一个利用网盘赚钱的方法，推荐的是台湾的xun6。今天要推荐的是另外一个利用下载赚钱的好东西——千脑网盘WordPress插件。注意：仅仅是推荐该插件。 对于单个作... ]]></description>
			<content:encoded><![CDATA[<p>在去年九月，博客联盟介绍了一个利用网盘赚钱的方法，推荐的是台湾的<a href="http://blogunion.org/money/xun6.html" target="_blank">xun6</a>。今天要推荐的是另外一个利用下载赚钱的好东西——千脑网盘WordPress插件。注意：仅仅是推荐该插件。</p>
<p>对于单个作者的WordPress下载博客来说，始终推荐xun6，因为最近xun6增加了不少服务器，下载速度有了很大的提升。但对于开放注册，并且允许甚至邀请网友来发布书籍的WordPress下载博客来说，利用千脑网盘的WordPress插件，则可以省去很多的烦恼。</p>
<p>跟所有的WordPress插件使用方法相同，下载、解压、上传、安装，然后去设置选项那里输入你的千脑ID。当然，使用默认的公共ID也行，只不过这样文件被下载将不被计入收入。</p>
<p>安装成功后，会在WordPress 撰写文章界面出现上传文件界面。上传和撰写是独立的，因此不会像WordPress自带的上传功能一样只能干等着。上传完后，资源的下载链接会自动插入到WordPress文章撰写区域，省去了复制的烦恼。</p>
<p>当然，目前还存在一些问题：</p>
<p>1，插件在IE6下表现正常，在Firefox下经常上传框不显示、下载链接无法插入到WordPress撰写区域。对于像博客联盟这样除了网银才用IE的blogger来说，就比较痛苦了。</p>
<p>2，即使在IE6下，插入到撰写区域的也仅仅只是一个连接，能否像xun6一样，直接提供html代码？默认的是ubb代码。当然，这个要求有点苛求了。</p>
<p>千脑网盘WordPress插件下载及详细安装方法<a href="http://www.tuzhua.com/?p=80" target="_blank">点这里</a>，多谢插件作者的努力。如果xun6官方也能开发这样一个WordPress插件，那就完美了 <img src='http://blogunion.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2011年08月07日 -- <a href="http://blogunion.org/money/yunfile.html" title="博客下载赚钱推荐：yunfile网盘">博客下载赚钱推荐：yunfile网盘</a> (11)</li><li>2009年09月25日 -- <a href="http://blogunion.org/money/xun6.html" title="博客下载赚钱必备利器：讯6">博客下载赚钱必备利器：讯6</a> (61)</li><li>2009年09月15日 -- <a href="http://blogunion.org/blogging-tools/2network-hard-disks.html" title="推荐两款可以实现站内上传文件的网络硬盘">推荐两款可以实现站内上传文件的网络硬盘</a> (11)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-plugins/qiannao-wordpress-plugin.html/feed</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/wordpress-phpmyadmin.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/wordpress-phpmyadmin.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 14:42:58 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WordPress搬家]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1180</guid>
		<description><![CDATA[在前一阵子里面，博客联盟已经介绍过，如何从实现两个域名之间的无缝转移。今天，博客联盟要介绍的是如何从phpmyadmin里面实现内容的批量替换。 为了便于说明，我们以具体的域名为例——... ]]></description>
			<content:encoded><![CDATA[<p>在前一阵子里面，<a href="http://blogunion.org/">博客联盟</a>已经介绍过，<a href="http://blogunion.org/wordpress/wordpress-tips/transfer-from-different-domains.html">如何从实现两个域名之间的无缝转移</a>。今天，博客联盟要介绍的是如何从phpmyadmin里面实现内容的批量替换。</p>
<p>为了便于说明，我们以具体的域名为例——如何将show.blogunion.org的内容全部批量转链接为blogunion.org 。</p>
<p><strong>第一步，备份原来的数据库，并且导入新的数据库，原来域名下面上传的文件一律按原来的目录重新上传。</strong></p>
<p><strong>第二步，进入phpmyadmin，点击搜索，搜索你要替换的内容。</strong>在本文，即搜索show.blogunion.org。接着你就会发现，在phpmyadmin里面，有很多个表都涉及到show.blogunion.org。</p>
<p align="center" style="border:1px solid #ccc;"><a href="http://blogunion.org/"><img title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" src="http://blogunion.org/wp-content/uploads/2010/03/phpmyadmin-01.jpg" border="1" alt="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" /></a></p>
<p align="center">在搜索框里面输入你要查找替换的内容。</p>
<p align="center" style="border:1px solid #ccc;"><a href="http://blogunion.org/"><img title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" src="http://blogunion.org/wp-content/uploads/2010/03/phpmyadmin-02.jpg" border="1" alt="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" /></a></p>
<p align="center">搜索结果会显示哪些表涉及到要替换的内容。</p>
<p><strong>第三步，点击其中一个表进入，并且找到需替换的内容blogunion.org所在的字段。</strong></p>
<p><strong>第四步，进入sql界面，并运行以下的MySQL语句：</strong></p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">UPDATE `umdposts` SET `guid` = REPLACE(`guid`,'show.blogunion.org','blogunion.org');</li></ol></div>
<p>其中umdposts是表，guid是字段。</p>
<p align="center" style="border:1px solid #ccc;"><a href="http://blogunion.org/"><img title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" src="http://blogunion.org/wp-content/uploads/2010/03/phpmyadmin-03.jpg" border="1" alt="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" /></a></p>
<p align="center" style="border:1px solid #ccc;"><a href="http://blogunion.org/"><img title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" src="http://blogunion.org/wp-content/uploads/2010/03/phpmyadmin-04.jpg" border="1" alt="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" /></a></p>
<p><strong>第五步，批量替换其他相关的内容。</strong></p>
<p>如果文件目录有变动，同时需批量修改文件目录的路径。</p>
<p><strong>第六步：当你搜索要替换的时候，出现以下画面就表示你功德圆满了。</strong></p>
<p align="center" style="border:1px solid #ccc;"><a href="http://blogunion.org/"><img title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" src="http://blogunion.org/wp-content/uploads/2010/03/phpmyadmin-05.jpg" border="1" alt="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容" /></a></p>
<p>注：本文 演示的只是批量替换链接，其他的内容替换一样的操作。</p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2009年11月01日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/31-free-wordpress-photo-themes.html" title="强烈推荐：31款免费WordPress图片模板">强烈推荐：31款免费WordPress图片模板</a> (24)</li><li>2009年10月14日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/8-ways-to-make-wordpress-easier-to-use.html" title="让客户对WordPress更满意的八种方式——八大WordPress优化插件推荐">让客户对WordPress更满意的八种方式——八大WordPress优化插件推荐</a> (20)</li><li>2009年07月13日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/16-beautiful-wordpress-showcase-sites.html" title="推荐16个收集 wordpress 建站精彩案例的站点">推荐16个收集 wordpress 建站精彩案例的站点</a> (9)</li><li>2009年05月10日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/ezwpthemes.html" title="EZwpthemes：提供适合女性使用的wordpress主题下载">EZwpthemes：提供适合女性使用的wordpress主题下载</a> (5)</li><li>2009年01月25日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/smart-ads%ef%bc%8c%e8%87%aa%e5%ae%9a%e4%b9%89%e6%98%be%e7%a4%ba%e5%8d%9a%e5%ae%a2%e5%b9%bf%e5%91%8a.html" title="Smart Ads，自定义显示博客广告">Smart Ads，自定义显示博客广告</a> (5)</li><li>2008年04月07日 -- <a href="http://blogunion.org/blogging-tools/7zip.html" title="7zip，压缩sql数据库的利器">7zip，压缩sql数据库的利器</a> (16)</li><li>2008年03月27日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/top-10-anti-spam-plugins.html" title="10大 wordpress 反垃圾评论插件">10大 wordpress 反垃圾评论插件</a> (9)</li><li>2008年02月02日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html" title="wordpress 搜索引擎优化的二十条实用技巧">wordpress 搜索引擎优化的二十条实用技巧</a> (17)</li><li>2008年01月29日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/branford-magazine-theme-tutorial.html" title="Branford Magazine模板简明使用教程">Branford Magazine模板简明使用教程</a> (15)</li><li>2008年01月22日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/8-photoblog-themes.html" title="推荐8款wordpress图片模板">推荐8款wordpress图片模板</a> (7)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/wordpress-phpmyadmin.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress 如何批量修改文章所属的分类？</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/change-categories.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/change-categories.html#comments</comments>
		<pubDate>Sun, 14 Mar 2010 10:11:19 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[WordPress批量修改分类]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1176</guid>
		<description><![CDATA[WordPress 该如何批量修改文章所属的分类？尤其涉及到文章数量比较大的时候，比方超过5000的数量，按照常规一篇一篇来编辑修改，这个工作量就非常大了。 一般而言，通过以下两个步骤，可... ]]></description>
			<content:encoded><![CDATA[<p>WordPress 该如何批量修改文章所属的分类？尤其涉及到文章数量比较大的时候，比方超过5000的数量，按照常规一篇一篇来编辑修改，这个工作量就非常大了。</p>
<p>一般而言，通过以下两个步骤，可以有效的解决这个烦恼。</p>
<p><strong>第一步，修改WordPress管理后台默认文章显示的数量。</strong></p>
<p>WordPress 后台默认是显示每页显示15篇文章，我们可以把这个数值修改大一些，这样批量修改文章分类的时候就会快速很多。博客联盟是把默认的15篇修改为50篇，批量修改的时候速度还是挺快的。</p>
<p>首先，找到wp-admin/includes/目录下的post.php文件，用emeditor打开，查找如下代码：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">$posts_per_page = (int) get_user_option( 'edit_per_page', 0, false );</li>
<li>	if ( empty( $posts_per_page ) || $posts_per_page &lt; 1 )</li>
<li>		$posts_per_page = 15;</li>
<li>	$posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );</li></ol></div>
<p>然后，把“posts_per_page = 15”的15换成你想要显示的数量就可以了。建议数量不要设太大，否则处理速度会比较慢。如果是cpu限制比较严格的海外主机，可能还会造成不必要的麻烦。</p>
<p><strong>第二部，在WordPress管理后台的编辑文章界面进行批量处理。</strong></p>
<p>首先，选择你要修改文章的分类 ，选择批量动作下面的编辑，再点应用。然后选择新的文章分类就可以了。具体如下图所示：</p>
<div align="center"><img src="http://blogunion.org/wp-content/uploads/2010/03/change-category.jpg" alt="" title="change-category" width="500" height="350" class="alignnone size-full wp-image-1177" border="1"/></div>
<p><strong>注意：原来的分类不用选也会默认保留，如果你要把原来的分类去掉的话，首先得把该分类去除。</strong></p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2008年09月08日 -- <a href="http://blogunion.org/internet/guagnzhou-jiangzuo.html" title="广州讲座以及广州讲座豆瓣小组">广州讲座以及广州讲座豆瓣小组</a> (14)</li><li>2007年03月31日 -- <a href="http://blogunion.org/blogging-tips/blog-co-adn-seo.html" title="博客优化方法">博客优化方法</a> (8)</li><li>2008年01月29日 -- <a href="http://blogunion.org/research/blog-in-france.html" title="博客在法国的发展概况">博客在法国的发展概况</a> (2)</li><li>2006年12月26日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/cricket-moods.html" title="wordpress插件之Cricket Moods：给你的日志添加心情图标">wordpress插件之Cricket Moods：给你的日志添加心情图标</a> (10)</li><li>2006年12月18日 -- <a href="http://blogunion.org/money/90-adsense-tips.html" title="90条Google Adsense建议与技巧">90条Google Adsense建议与技巧</a> (3)</li><li>2007年12月24日 -- <a href="http://blogunion.org/blogging-tips/zhuaxia-2007-top-ranked-posts.html" title="2007抓虾最热50篇文章分析">2007抓虾最热50篇文章分析</a> (34)</li><li>2006年12月03日 -- <a href="http://blogunion.org/blogging-tools/bsp-banjia.html" title="国内博客（blog）搬家工具（服务）大全">国内博客（blog）搬家工具（服务）大全</a> (35)</li><li>2008年01月15日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/5-premium-themes.html" title="推荐五款漂亮的wordpress付费模板">推荐五款漂亮的wordpress付费模板</a> (6)</li><li>2006年11月15日 -- <a href="http://blogunion.org/log/hello-world.html" title="博客联盟开张">博客联盟开张</a> (7)</li><li>2007年05月06日 -- <a href="http://blogunion.org/blogs/top-100-english-blogs-with-most-feed-subscribers.html" title="国外RSS订阅数最多的100个博客">国外RSS订阅数最多的100个博客</a> (15)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/change-categories.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

