<?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/wordpress-tips/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>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搬家教程之二：如何从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年06月14日 -- <a href="http://blogunion.org/blogs/beautiful.html" title="我眼中的漂亮博客">我眼中的漂亮博客</a> (48)</li><li>2007年06月02日 -- <a href="http://blogunion.org/money/made-for-adsense-list.html" title="我所知道的Google Adsense 点击单价超低的网站列表">我所知道的Google Adsense 点击单价超低的网站列表</a> (25)</li><li>2007年01月24日 -- <a href="http://blogunion.org/money/adsenser-dot-cn.html" title="谷歌联盟 AdSenser.cn：Google Adsense广告点击跟踪统计网站">谷歌联盟 AdSenser.cn：Google Adsense广告点击跟踪统计网站</a> (3)</li><li>2007年09月21日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/3-questions-about-alimama.html" title="关于阿里妈妈&#8221;成功推荐一个网站获得20元奖励“的三个疑问">关于阿里妈妈&#8221;成功推荐一个网站获得20元奖励“的三个疑问</a> (26)</li><li>2005年09月30日 -- <a href="http://blogunion.org/internet/blog-zhiye.html" title="博客是种职业">博客是种职业</a> (0)</li><li>2006年12月17日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/2c3d-wordpress-theme-10.html" title="wordpress模版收集之2c3d：两本书堆成的模版">wordpress模版收集之2c3d：两本书堆成的模版</a> (0)</li><li>2007年06月30日 -- <a href="http://blogunion.org/seo/blog-pagerank-vs-website-pagerank.html" title="博客PageRank值与网站PageRank值是有区别的">博客PageRank值与网站PageRank值是有区别的</a> (36)</li><li>2008年12月18日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/wp-dtree.html" title="WP-dTree插件，优化分类、页面以及链接的显示方式">WP-dTree插件，优化分类、页面以及链接的显示方式</a> (0)</li><li>2007年07月06日 -- <a href="http://blogunion.org/blogs/finance-blogs.html" title="博客秀第13辑：推荐16个财经类博客">博客秀第13辑：推荐16个财经类博客</a> (13)</li><li>2011年08月07日 -- <a href="http://blogunion.org/money/yunfile.html" title="博客下载赚钱推荐：yunfile网盘">博客下载赚钱推荐：yunfile网盘</a> (11)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/change-categories.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>如何实现 WordPress 博客新旧域名无缝转移？</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/transfer-from-different-domains.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/transfer-from-different-domains.html#comments</comments>
		<pubDate>Sat, 06 Mar 2010 10:47:07 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[WordPress转移]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1172</guid>
		<description><![CDATA[虎年的第一篇——如何实现 WordPress 博客新旧域名无缝转移？ 第一步：内容转移。 如果是同一个空间，在ftp里面直接把旧域名的内容全部移动到新的域名下面。当然，如果在不同的空间，那就... ]]></description>
			<content:encoded><![CDATA[<p>虎年的第一篇——如何实现 WordPress 博客新旧域名无缝转移？</p>
<p><strong>第一步：内容转移。</strong></p>
<p>如果是同一个空间，在ftp里面直接把旧域名的内容全部移动到新的域名下面。当然，如果在不同的空间，那就比较杯具了，得把旧域名的内容下下来，再传到新的空间。</p>
<p><strong>第二步：MySQL数据导入。</strong></p>
<p>新建一个名字相同的数据库，用户名和密码也相同。然后在新空间的phpmyadmin 后台，把备份的MySQL数据导入。</p>
<p><strong>第三部，修改部分链接。</strong></p>
<p>在phpmyadmin里面，搜索旧的域名，然后点击编辑，修改成新的域名即可，到此步完成。</p>
<p>据闻用以下SQL语句可以实现替换，俺没试过。</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 `表名` SET `字段` = REPLACE(`字段`,'替换内容','替换值');</li></ol></div>
<p><strong>第四步：利用 .htaccess 实现全站内容301跳转</strong></p>
<p>在.htaccess 文件里面添加如下代码，然后上传到网站根目录即可。注：将里面的域名换成你自己的域名。</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">RewriteEngine on</li>
<li>RewriteRule ^(.*)$ http://www.你的域名.com/$1 [R=301,L]</li></ol></div>
<p>祝各位虎年好运！祝福不怕晚 <img src='http://blogunion.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </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>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>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>2006年03月11日 -- <a href="http://blogunion.org/internet/blog-business-model.html" title="博客盈利：徐静蕾PK洪波">博客盈利：徐静蕾PK洪波</a> (0)</li><li>2006年12月07日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/green-grass.html" title="wordpress模版收集之green grass">wordpress模版收集之green grass</a> (0)</li><li>2006年12月07日 -- <a href="http://blogunion.org/log/changed-the-index-page.html" title="博客联盟首页调整">博客联盟首页调整</a> (0)</li><li>2008年01月28日 -- <a href="http://blogunion.org/wordpress/wordpress-themes/branford-magazine.html" title="推荐一款免费的杂志型模板：BranfordMagazine">推荐一款免费的杂志型模板：BranfordMagazine</a> (15)</li><li>2006年11月26日 -- <a href="http://blogunion.org/blogging-tools/free-blog-softwares.html" title="嘿熊推荐的免费blog软件">嘿熊推荐的免费blog软件</a> (3)</li><li>2005年10月01日 -- <a href="http://blogunion.org/internet/sina-blog-vs-bokee-freecity.html" title="中国博客又起风浪——sina blog VS bokee freecity">中国博客又起风浪——sina blog VS bokee freecity</a> (0)</li><li>2008年01月21日 -- <a href="http://blogunion.org/blogs/shang-shan-ruo-shui.html" title="本周之星：博客生涯不是梦">本周之星：博客生涯不是梦</a> (22)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/transfer-from-different-domains.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>让客户对WordPress更满意的八种方式——八大WordPress优化插件推荐</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/8-ways-to-make-wordpress-easier-to-use.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/8-ways-to-make-wordpress-easier-to-use.html#comments</comments>
		<pubDate>Wed, 14 Oct 2009 15:23:47 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WordPress优化]]></category>
		<category><![CDATA[wordpress建站]]></category>
		<category><![CDATA[wordpress插件]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1130</guid>
		<description><![CDATA[博客联盟大概从2006年中旬开始使用WordPress程序，用的久了，就习惯了，总以为一切设计都是合理的。最近给几个客户用WordPress建站，才发现客户对WordPress的接受程度确实不太高，尤其是对控制... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogunion.org/">博客联盟</a>大概从2006年中旬开始使用WordPress程序，用的久了，就习惯了，总以为一切设计都是合理的。最近给几个客户用<a href="http://blogunion.org/services">WordPress建站</a>，才发现客户对WordPress的接受程度确实不太高，尤其是对控制面板以及撰写界面的抗拒感最为严重。</p>
<p>给客户做网站，最大的困难不在于技术，而在于如何跟客户沟通——包括前期的沟通，建设中的头痛以及后期维护的沟通等等。一般而言，越对程序不了解的人越喜欢折腾，在这个时候，沟通就显得尤为重要了。除了沟通外，另外一种行之有效的方法，就是让一切都模块化，客户喜欢怎么折腾都行——只需要通过鼠标的拖曳就可以完成。</p>
<p>今天发现一篇<a href="http://www.designer-daily.com/8-ways-to-make-wordpress-easier-to-use-for-your-clients-4580" target="_blank">8 ways to make WordPress easier to use for your clients</a>的文章，与我心有戚戚焉，特地翻译出来。选了其中六个，另外两个以博客联盟的经验来看，不是太必要。有兴趣的读者请直接阅读原文。</p>
<p><strong>1. 安装TinyMCE advanced插件</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="tinymce advanced" src="http://blogunion.org/wp-content/uploads/2009/10/tiny-mce-advanced.jpg" alt="tinymce advanced" width="450" height="155" style="border:1px solid #ccc;"/></p>
<p>跟其他网站的博客撰写界面相比而言，WordPress 默认的撰写界面功能实在是有限。客户经常会觉得你建的网站功能怎么这么弱，或者问，我要插入flash怎么办啊，我要插入视频怎么办啊，我要插入音频怎么办啊等等等诸如此类的问题。安装TinyMCE advanced插件后，你可以省去很多给客户解释的时间。</p>
<p>TinyMCE advanced plugin插件<a href="http://www.laptoptips.ca/projects/tinymce-advanced/" target="_blank">下载点这里</a>。</p>
<p><strong>2. 给widgets添加富文本编辑框</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="rich-text-widget" src="http://blogunion.org/wp-content/uploads/2009/10/rich-text-widget.jpg" alt="rich-text-widget" width="450" height="270"  style="border:1px solid #ccc;"/></p>
<p>widgets是网站建设者的福音，有了widgets，客户想怎么折腾都行，并且不需要懂啥html之类的知识。没有widgets，碰上爱折腾的客户，恐怕就只有崩溃的份了。但widgets有一个缺点就是如果给文字添加一些特效或者添加图片之类，还是需要懂一些代码。安装 rich text widget 这个WordPress 插件后就基本上解决了这个问题。</p>
<p>rich text widget 下载<a href="http://wordpress.org/extend/plugins/rich-text-widget/" target="_blank">点这里</a></p>
<p><strong>3.让页面的控制更加简单</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="wordpress page management" src="http://blogunion.org/wp-content/uploads/2009/10/wordpress-page-management.jpg" alt="wordpress page management" width="450" height="227"  style="border:1px solid #ccc;"/></p>
<p>WordPress 的页面功能很好，但对于绝大多数的人而言，控制页面的现实顺序非常麻烦。如果碰上不懂代码的客户，就会很麻烦。还好WordPress有足够的插件来解决这个问题——你只需要安装pagemash插件后，客户用鼠标拖拉就可以控制页面的顺序了。</p>
<p>pagemash安装<a href="http://wordpress.org/extend/plugins/pagemash/" target="_blank">点这里</a>。</p>
<p><strong>4. 让WordPress 控制面板的导航更友好</strong></p>
<p style="text-align: center;"><img class="aligncenter" src="http://blogunion.org/wp-content/uploads/2009/10/navigation-control.jpg" alt="navigation control" width="450" height="360"  style="border:1px solid #ccc;"/></p>
<p>可定制化的方案就是最好的方案——这样无论客户想怎么折腾，时间和精力交给他们自己。对于WordPress的控制面板也是如此，建议给客户安装Wordpress Navigation List插件，让他们折腾去吧。</p>
<p>WordPress Navigation List 插件安装<a href="http://wordpress.org/extend/plugins/wordpress-navigation-list-plugin-navt/" target="_blank">点这里</a>。</p>
<p><strong>5. 控制客户访问的权限</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="advanced user permission" src="http://blogunion.org/wp-content/uploads/2009/10/advanced-user-permission.jpg" alt="advanced user permission" width="450" height="234"  style="border:1px solid #ccc;"/></p>
<p>其实客户很多时候对网站的很多功能是用不到的，一旦他们误操作可能对网站产生比较大的危害。这个时候，你可以控制他们的访问权限。</p>
<p>实现这个功能的插件叫 Adminize plugin，下载<a href="http://wordpress.org/extend/plugins/adminimize/" target="_blank">点这里</a> 。</p>
<p><strong>6. 让客户直接在后台看到流量统计</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="google analyticator" src="http://blogunion.org/wp-content/uploads/2009/10/google-analyticator.jpg" alt="google analyticator" width="450" height="206"  style="border:1px solid #ccc;"/></p>
<p>我之前给客户安装WordPress网站的时候，用的是statcounter的流量统计，客户觉得很不可思议，为什么不能登陆网站后台就可以直接看到流量统计呢？百度空间，blogbus等等都是登陆后就可以看到流量的啊。</p>
<p>遇到这个问题，就可以采用<a href="http://plugins.spiralwebconsulting.com/analyticator.html" target="_blank">Google Analyticator</a>这个插件来解决问题了。如果还需要动态了解 rss 订阅数量的变化，则可以安装<a href="http://wordpress.org/extend/plugins/feed-stats-plugin/" target="_blank">Feed stats</a>这个插件，让WordPress网站后台可以直接显示FeedBurner订阅数的变化。</p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年03月23日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/wordpress-phpmyadmin.html" title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容">WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容</a> (3)</li><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年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年12月11日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/wordpress-hidepost-plugin.html" title="wordpress hidepost plugin，让你的文章仅注册用户可看">wordpress hidepost plugin，让你的文章仅注册用户可看</a> (4)</li><li>2008年04月08日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/plugin-central.html" title="Plugin Central，一键安装和升级多个wordpress插件">Plugin Central，一键安装和升级多个wordpress插件</a> (27)</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></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/8-ways-to-make-wordpress-easier-to-use.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>导入的 WordPress WXR XML 文件过大，怎么办？</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/how-to-import-a-wordpress-wxr-file-when-it-says-too-large-to-import.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/how-to-import-a-wordpress-wxr-file-when-it-says-too-large-to-import.html#comments</comments>
		<pubDate>Sat, 01 Aug 2009 09:38:20 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[WXR]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://blogunion.org/?p=1089</guid>
		<description><![CDATA[最近又在折腾主机，有几个博客要搬到新的虚拟主机，由于是国外的虚拟主机，进入 phpmyadmin 后台导入mysql数据非常慢，导了了N次都失败，一肚子火，网上找资料... ]]></description>
			<content:encoded><![CDATA[<p>最近又在折腾主机，有几个博客要搬到新的虚拟主机，由于是国外的虚拟主机，进入 phpmyadmin 后台导入mysql数据非常慢，导了了N次都失败，一肚子火，网上找资料。</p>
<p><strong><a href="http://codex.wordpress.org/FAQ_Working_with_WordPress#How_do_I_Import_a_WordPress_WXR_file_when_it_says_it_is_too_large_to_import.3F" target="_blank">wordpress 官方</a>有如下的操作方法：</strong></p>
<p>第一步：使用文件切割软件，把导出的 XML 文件切割成你的主机商允许的大小，例如我的是8M。</p>
<p>第二步，用Emeditor 或者 Editorplus 编辑切割后的 WordPress WXR XML 文件，在每一个文件的顶部加上下面的代码：</p>
<p>下面的代码加在最前面：</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">&lt;rss version=&quot;2.0&quot;</li>
<li>	xmlns:content=&quot;http://purl.org/rss/1.0/modules/content/&quot;</li>
<li>	xmlns:wfw=&quot;http://wellformedweb.org/CommentAPI/&quot;</li>
<li>	xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot;</li>
<li>	xmlns:wp=&quot;http://wordpress.org/export/1.0/&quot;</li>
<li>&gt;</li>
<li>&lt;channel&gt;</li>
<li>在第一个 &lt;item&gt; 前加入所有的信息，如博客名称，分类，tag等。</li></ol></div>
<p>下面的代码加在最后面：</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">&lt;/channel&gt;</li>
<li>&lt;/rss&gt;</li></ol></div>
<p>使用这种方法有个缺陷：切割的时候未必能够幸运的每一个文件都切割到整一个Item，很有可能一片文章的标题在上一个文件，正文在下一个文件。<br />
<strong><br />
笨人的笨方法：</strong></p>
<p>通过上面的操作，差不多明白了，只需要头部那部分所需的代码在，以及顶部的那部分代码在， WordPress WXR XML 文件就是有效的，所以接下来的操作就很简单了：</p>
<p>第一步，打开从后台导出的 WordPress WXR XML 文件，剪切到N个完整的一个item，使整个  WordPress WXR XML 文件适合上传文件大小上限，然后从后台导入。</p>
<p>第二步，把已经上传了的那部分item清除，然后把刚刚剪切的未导入的文件复制到 WordPress WXR XML 里面，再上传。</p>
<p>第三步：重复上面两步，直到全部导入完毕。</p>
<p>注意：看着挺复杂，原理很简单——留下头尾，中间内容部分替换即可。记得保存为UTF8编码，另外数据记得备份。</p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2008年02月18日 -- <a href="http://blogunion.org/log/stupid-again.html" title="又傻逼了一回">又傻逼了一回</a> (24)</li><li>2007年09月29日 -- <a href="http://blogunion.org/problogger/tips-for-backup.html" title="博客备份的六个小技巧">博客备份的六个小技巧</a> (17)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/how-to-import-a-wordpress-wxr-file-when-it-says-too-large-to-import.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>wordpress 搜索引擎优化的二十条实用技巧</title>
		<link>http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html</link>
		<comments>http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html#comments</comments>
		<pubDate>Fri, 01 Feb 2008 21:46:56 +0000</pubDate>
		<dc:creator>老曾</dc:creator>
				<category><![CDATA[wordpress使用技巧]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[博客推广优化]]></category>

		<guid isPermaLink="false">http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html</guid>
		<description><![CDATA[1，不要禁止搜索引擎索引。 搜索引擎优化的第一步，就是不能禁止搜索引擎爬虫的索引。一般而言， 在安装wordpress 的时候默认是允许搜索引擎索引的。当然，如果你不小心在安装的时候选择... ]]></description>
			<content:encoded><![CDATA[<p><strong>1，不要禁止搜索引擎索引。</strong></p>
<p>搜索引擎优化的第一步，就是不能禁止搜索引擎爬虫的索引。一般而言， 在安装wordpress 的时候默认是允许搜索引擎索引的。当然，如果你不小心在安装的时候选择了禁止也没有关系，你可以通过登陆wordpress 控制面板，在 隐私（privacy）菜单里面修改。</p>
<p><strong>2，你的博客有一个<a href="http://blogunion.org/problogger/blogging-topic-selection.html" target="_blank">明确的主题</a>吗？</strong></p>
<p>很多人都喜欢把什么都往博客里面扔，汽车啊，电影啊，音乐啊，等等等。当然，这样的做法并没有错。但是，搜索引擎是很笨的，你的主题太多太杂，搜索引擎就不知道你的博客是关于什么的。同时，读者对这种形式也会感到疑惑。更多关于博客主题的文章请参考<a href="http://blogunion.org/problogger/blogging-topic-selection.html" target="_blank">博客主题的确定</a>，以及<a href="http://blogunion.org/problogger/personal-blog-or-topic-blog.html" target="_blank">你是做独立个人博客，还是独立主题博客</a>两篇文章。</p>
<p><strong>3，URL网址规范化。</strong></p>
<p>如果你的每篇文章都有多个网址，那么你可能会面临以下的问题：</p>
<ul>
<li>搜索引擎不知道该在搜索结果联盟显示哪一个网址；</li>
<li>pagerank在多个网址之间流失；</li>
<li>因复制内容受惩罚。</li>
</ul>
<p>当然，wordpress 2.3 之后，一篇文章多个网址的问题已经解决了。所以，如果你还在使用老版本的话，赶紧升级到最新版本，或者，安装 wordpress 链接跳转插件。详情可以参考niky的<a href="http://www.osxcn.com/wordpress/let-wordpress-the-url-standardization.html" target="_blank">让WordPress 的 URL 规范化</a>一文。</p>
<p><strong>4，代码通过 XHTML 验证。</strong></p>
<p>绝大多数的时候，代码错误带来的影响非常小，但是一些严重的错误可能乎引起搜素引擎的误解，从而使你的博客被降权。</p>
<p>wordpress本身的代码是很规范的，但一旦你使用了代码不规范的模板，或者插件，则可能会带来错误的代码。另外，blogger在写文章的时候，也有可能会产生错误的代码。</p>
<p>因此，选择模板的时候，最好是从一些比较知名的设计者那里找。另外，下载模板的时候，最好也直接去作者的主页或者官方网页下载，不要去第三方网站下载。</p>
<p><strong>5，侧边栏不要有太多的链接。</strong></p>
<p>这一点，可以参考<a href="http://blogunion.org/blogging-tips/optimize-your-sidebar.html" target="_blank">如何优化博客的侧边栏</a>一文。</p>
<p><strong>6，在文章里面使用图片。</strong></p>
<p>在文章里面使用图片，不仅能够吸引读者的注意，还能够使用 alt 标签，title 标签，已经文件名。这些都可以在一定程度上增加文章的关键词。同时，还可以让你的文章出现在图片搜素里面。</p>
<p><strong>7，正确的使用 H 标签</strong>。</p>
<ul>
<li>博客的标题，或者主要的关键词应该使用H1 标签。</li>
<li>如果博客的副标题或者描述也含有关键词，那么应该加个H2标签。否则的话使用div标签就行了。</li>
<li>文章标题应该使用h2 标签。</li>
<li>侧边栏的标题应该使用h3标签，或者是不加 H 标签。</li>
</ul>
<p>很多模板的侧边栏标题都使用的是H2标签，包括wordpress 自带的默认模板也是。</p>
<p><strong>8，使用 ping 服务。</strong></p>
<p>ping 服务非常重要，他可以让你的文章尽可能快的被搜索引擎索引。具体你可以参考<a href="http://www.essentialblog.cn/ping-list/" target="_blank">wordpress ping 列表</a>。</p>
<p>另外需要注意的是，你发布文章之后，无论是编辑还是修改，都会再ping 一遍。所以，文章发布之后，不要再频繁的编辑和修改。</p>
<p><strong>9，安装 <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" target="_blank">Google XML Sitemaps Generator</a> 插件。</strong></p>
<p>不知道有没有谁专门针对百度写了类似的插件，BaiDu XML Sitemap Generator？</p>
<p><strong>10，不要使用带有赞助商链接的模板。</strong></p>
<p>一些模板设计者会在模板的底部或者别的地方带上赞助商的链接，这些链接通常都是一些付费链接。使用这类模板，很容易因为买卖链接的问题而收到惩罚。</p>
<p><strong>11，使用传统的SEO技术。</strong></p>
<p>博客也是站点，站点优化的内容与技巧同样适合于博客，如：</p>
<ul>
<li>在标题和文章里面使用关键字。</li>
<li>关键字加粗凸显</li>
<li>增加反向链接</li>
<li>多看看 <a href="http://blogunion.org/blogs/chinese-seo-blog-list.html" target="_blank">搜索引擎优化 （SEO） 博客</a></li>
</ul>
<p><strong>12，注重文章缩略名的写法</strong></p>
<p>这一点主要是针对使用了英文缩略名的博客，非英文缩略名的wordpress 博客则不用考虑这一点。在缩略名里面，可以适当的添加关键词。</p>
<p><strong>13，设定文章的发布日期。</strong></p>
<p>搜索引擎和读者都喜欢新鲜的内容，但我们绝大多数的blogger，可能某一天灵感爆发，写了很多内容，然后接下来很久都写不出一篇。这个时候，你可以<a href="http://blogunion.org/wordpress/wordpress-tips/publish-your-post-automatically.html" target="_blank">wordpress 的自动发布功能</a>设定文章的发布日期来解决这个问题。</p>
<p>但博客联盟认为，最好是<a href="http://blogunion.org/blogging-tips/10-tips-for-writing-more.html" target="_blank">有文就立刻发</a>。当然，这两种方法各有可取之处，谁是谁非，还得看个人的习惯以及其他的原因。没有任何一个技巧是通用的，适合自己的就是最好的。</p>
<p><strong>14，使用标签功能</strong></p>
<p>wordpress 2.3及以上版本开始自带了tag功能，只要你在文章当中使用了标签功能，wordpress 会为你的每个关键字生成一个页面。这样你就能获得大量的含关键字的内部链接。</p>
<p><strong>15，整合<a href="http://blogunion.org/pages/social-bookmarks/" target="_blank">社会化媒体网站</a></strong></p>
<p>在博客上面添加社会化媒体网站的收藏或者推荐功能。国内建议使用<a href="http://fairyfish.net/2008/01/19/bookmark-share-plugin/" target="_blank">收藏 &amp;分享的 WordPress 插件</a>，以及<a href="http://re.xianguo.com/api/diggtool" target="_blank">鲜果的站外推荐</a>按钮。</p>
<p><strong>16，深度链接。</strong></p>
<p>在博客上实行深度链接的几个方法：</p>
<ul>
<li>在文章里面链接到博客内的其他文章，注意使用合适的关键词。</li>
<li>使用相关文章插件。博客联盟推荐显示同一分类下面文章的插件。</li>
<li>在侧边栏显示最受欢迎文章，可以使用<a href="http://alexking.org/projects/wordpress/readme?project=popularity-contest" target="_blank">Popularity Contest </a>插件，或者<a href="http://yanfeng.org/blog/wordpress/kit" target="_blank"> wordpress 中文工具箱</a>插件。</li>
</ul>
<p><strong>17，让抄袭者和自动聚合网站为你服务。</strong></p>
<p>这一点在国内尤其有用。复制，全文转载非常的流行，自动聚合网站也非常多。只要你在文章里面添加站内的文章链接，很容易就能过获得很多的反向链接。</p>
<p>另外，对于那种通过 rss 来自动聚合的网站，你还可以使用以下三种方法来让他们为你服务：</p>
<ul>
<li>使用<a href="http://www.solo-technology.com/apps.html" target="_blank">ST Add Related Posts to Feed</a>插件来在feed底部增加相关文章的链接</li>
<li>使用<a href="http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/" target="_blank">better feed</a>在文章底部添加版权生命。</li>
<li>在feed里面展示广告。</li>
</ul>
<p><strong>18，安装All in One SEO Pack插件。</strong></p>
<p>请参考<a href="http://blogunion.org/wordpress/wordpress-plugins/all-in-one-seo-pack.html" target="_blank">wordpress插件之All in One SEO Pack：整体优化你的wordpress博客</a>一文。</p>
<p><strong>19，优化永久链接。</strong></p>
<p>关于这一点，请参考<a href="http://blogunion.org/wordpress/wordpress-tips/url-setting-tips.html" target="_blank">wordpress永久链接设置的六大技巧</a>一文。</p>
<p><strong>20，使用带分类的永久链接地址。</strong></p>
<p>这一点，<a href="http://blogunion.org//" target="_blank">博客联盟</a>不是太同意，因为一篇文章有时候可能属于多个分类，另外，碰到一些特殊情况，例如上次的<a href="http://blogunion.org/log/new-year-new-design.html" target="_blank">Structure theme</a>那个模板，就可能出现一些小麻烦，甚至可能是大麻烦。</p>
<p>原文标题及链接：<a href="http://www.seodesignsolutions.com/blog/wordpress-seo/20-practical-seo-tips-to-super-charge-your-wordpress-blog/" target="_blank">20 Practical SEO Tips to Super-Charge Your WordPress Blog!</a></p>
<p>译文标题及链接：<a href="http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html" rel="bookmark" target="_blank">wordpress 搜索引擎优化（SEO）的二十条技巧</a></p>
<h3  class="related_post_title">相关文章阅读</h3><ul class="related_post"><li>2010年03月23日 -- <a href="http://blogunion.org/wordpress/wordpress-tips/wordpress-phpmyadmin.html" title="WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容">WordPress搬家教程之二：如何从phpmyadmin里面批量替换内容</a> (3)</li><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年09月13日 -- <a href="http://blogunion.org/seo/sitemap-generator.html" title="Sitemap Generator 插件会导致搜索引擎收录量减少？">Sitemap Generator 插件会导致搜索引擎收录量减少？</a> (28)</li><li>2009年09月12日 -- <a href="http://blogunion.org/seo/get-comfused-with-seo.html" title="关于百度、谷歌搜索引擎优化的一些心得与困惑">关于百度、谷歌搜索引擎优化的一些心得与困惑</a> (16)</li><li>2009年07月19日 -- <a href="http://blogunion.org/seo/16-firefox-seo-tools-every-webmaster-should-know.html" title="每一个Blogger都应该知道的16个Firefox SEO 插件">每一个Blogger都应该知道的16个Firefox SEO 插件</a> (4)</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年03月27日 -- <a href="http://blogunion.org/wordpress/wordpress-plugins/top-10-anti-spam-plugins.html" title="10大 wordpress 反垃圾评论插件">10大 wordpress 反垃圾评论插件</a> (9)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blogunion.org/wordpress/wordpress-tips/20-practical-seo-tips.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

