<?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://pensee.net.cn/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://pensee.net.cn</link>
	<description>陕西鹏讯科技定位于Internet web2.0技术和服务提供商，致力于为客户提供Internet策划、建设、运维的整体解决方案。作为无忧服务理念的倡导者和实践者，公司自2005年成立以来，在政府、广电、电力、能源、大型企业等行业积累了大量的客户，与客户建立了长期合作的关系，赢得了广泛的好评。</description>
	<lastBuildDate>Sat, 21 Jan 2012 13:54:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>wordprees 高级技巧</title>
		<link>http://pensee.net.cn/wordprees-%e9%ab%98%e7%ba%a7%e6%8a%80%e5%b7%a7</link>
		<comments>http://pensee.net.cn/wordprees-%e9%ab%98%e7%ba%a7%e6%8a%80%e5%b7%a7#comments</comments>
		<pubDate>Tue, 26 Jan 2010 10:56:01 +0000</pubDate>
		<dc:creator>guoshuang</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pensee.net.cn/?p=700</guid>
		<description><![CDATA[定制自己的WordPress首页 在你的主题目录中拷贝、修改 page.php，注意一开始的 &#60;?php /* Template Name: GuoshuangTemplate */ ?&#62; 在后台的新建一个 page，并且设置该 page 的 模板 为 GuoshuangTemplate。 最后在 Settings » Reading 设置front page 为刚才这个 page 即可。 显示随机的 post &#60;?php query_posts(array(&#8216;orderby&#8217; =&#62; &#8216;rand&#8217;, &#8216;showposts&#8217; =&#62; 1)); if (have_posts()) : while (have_posts()) : the_post(); ?&#62; &#60;h1&#62;&#60;a href=&#8221;&#60;?php the_permalink() ?&#62;&#8221;&#62;&#60;?php the_title(); ?&#62;&#60;/a&#62;&#60;/h1&#62; &#60;?php the_content(); ?&#62; &#60;?php endwhile; endif; [...]]]></description>
			<content:encoded><![CDATA[<h2>定制自己的WordPress首页</h2>
<p>在你的主题目录中拷贝、修改 page.php，注意一开始的</p>
<p><code>&lt;?php /* Template Name: GuoshuangTemplate */ ?&gt;</code></p>
<p>在后台的新建一个 page，并且设置该 page 的  模板 为  GuoshuangTemplate。</p>
<p><img src="http://pensee.net.cn/wp-content/uploads/wordpress/custompagetemplate.gif" alt="wordpress custom page template" /></p>
<p>最后在 Settings » Reading 设置front page 为刚才这个 page 即可。</p>
<p><img src="http://pensee.net.cn/wp-content/uploads/wordpress/customhomepage.gif" alt="wordpress custom homepage" /></p>
<h2>显示随机的 post</h2>
<blockquote><p>&lt;?php<br />
query_posts(array(&#8216;orderby&#8217; =&gt; &#8216;rand&#8217;, &#8216;showposts&#8217; =&gt; 1));<br />
if (have_posts()) :<br />
while (have_posts()) : the_post(); ?&gt;</p>
<p>&lt;h1&gt;&lt;a href=&#8221;&lt;?php the_permalink() ?&gt;&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h1&gt;</p>
<p>&lt;?php the_content(); ?&gt;</p>
<p>&lt;?php endwhile;<br />
endif; ?&gt;</p></blockquote>
<h2>显示外部站点的 feed</h2>
<blockquote><p>&lt;?php include_once(ABSPATH.WPINC.&#8217;/feed.php&#8217;);<br />
$rss = fetch_feed(&#8216;http://feeds.feedburner.com/wpbeginner&#8217;);<br />
$maxitems = $rss-&gt;get_item_quantity(5);<br />
$rss_items = $rss-&gt;get_items(0, $maxitems);<br />
?&gt;<br />
&lt;ul&gt;<br />
&lt;?php if ($maxitems == 0) echo &#8216;&lt;li&gt;No items.&lt;/li&gt;&#8217;;<br />
else<br />
// Loop through each feed item and display each item as a hyperlink.<br />
foreach ( $rss_items as $item ) : ?&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8217;&lt;?php echo $item-&gt;get_permalink(); ?&gt;&#8217;<br />
title=&#8217;&lt;?php echo &#8216;Posted &#8216;.$item-&gt;get_date(&#8216;j F Y | g:i a&#8217;); ?&gt;&#8217;&gt;<br />
&lt;?php echo $item-&gt;get_title(); ?&gt;&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/ul&gt;</p></blockquote>
<h2>显示文章或者留言距现在的时间</h2>
<p>需要这个 plugin <a href="http://wordpress.org/extend/plugins/wp-relativedate/">wp relativedate</a>，在需要输出时期的地方使用下面代码</p>
<p><code>&lt;?php relative_post_the_date(); ?&gt;</code></p>
<h2>允许用户提交新闻</h2>
<p>用这个插件 <a href="http://wordpress.org/extend/plugins/tdo-mini-forms/">tdo-mini-forms</a>，使用说明在<a href="http://www.wpbeginner.com/plugins/how-to-allow-users-to-submit-news-posts-to-your-wordpress-site/">how to allow users to submit news posts to your wordpress site</a></p>
<h2>直接从标题链接到其它站点</h2>
<p>在 functions.php 添加定义</p>
<blockquote><p>function print_post_title() {<br />
global $post;<br />
$thePostID = $post-&gt;ID;<br />
$post_id = get_post($thePostID);<br />
$title = $post_id-&gt;post_title;<br />
$perm = get_permalink($post_id);<br />
$post_keys = array(); $post_val = array();<br />
$post_keys = get_post_custom_keys($thePostID);</p>
<p>if (!empty($post_keys)) {<br />
foreach ($post_keys as $pkey) {<br />
if ($pkey==&#8217;url1&#8242; || $pkey==&#8217;title_url&#8217; || $pkey==&#8217;url_title&#8217;) {<br />
$post_val = get_post_custom_values($pkey);<br />
}<br />
}<br />
if (empty($post_val)) {<br />
$link = $perm;<br />
} else {<br />
$link = $post_val[0];<br />
}<br />
} else {<br />
$link = $perm;<br />
}<br />
echo &#8216;&lt;h2&gt;&lt;a href=&#8221;&#8216;.$link.&#8217;&#8221; rel=&#8221;bookmark&#8221; title=&#8221;&#8216;.$title.&#8217;&#8221;&gt;&#8217;.$title.&#8217;&lt;/a&gt;&lt;/h2&gt;&#8217;;<br />
}</p></blockquote>
<p>然后把</p>
<p><code>&lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</code></p>
<p>改为</p>
<p><code>&lt;?php print_post_title(); ?&gt;</code></p>
<h2>用 wordpress 做邮件订阅服务器</h2>
<p><a href="http://www.wpbeginner.com/wp-tutorials/create-a-free-email-newsletter-service-using-wordpress/">create-a-free-email-newsletter-service-using-wordpress</a></p>
<h2>控制 post 显示条数</h2>
<blockquote><p>if ($count == &#8220;n&#8221;) { break; }<br />
else { ?&gt;</p></blockquote>
<h2>突出显示作者的留言</h2>
<p>定义样式表</p>
<p><code>.authorstyle {  background-color: #B3FFCC !important; }</code></p>
<p>修改 comments.php，替换下面代码</p>
<p><code>&lt;li &lt;?php echo $oddcomment; ?&gt;id="comment-&lt;?php comment_ID() ?&gt;"&gt;&lt;/li&gt;</code></p>
<p>为</p>
<p><code>&lt;liauthorstyle"; echo $oddcomment; ?&gt;"&gt;&lt;/li&gt;</code></p>
<h2>打开文章缩略图功能</h2>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-add-post-thumbnails-in-wordpress/">how-to-add-post-thumbnails-in-wordpress</a></p>
<h2>显示 feedburner 订阅数</h2>
<blockquote><p>&lt;?php<br />
//get cool feedburner count<br />
$whaturl=&#8221;http://api.feedburner.com/awareness/1.0/GetFeedData?uri=your feedburner id&#8221;;</p>
<p>//Initialize the Curl session<br />
$ch = curl_init();</p>
<p>//Set curl to return the data instead of printing it to the browser.<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</p>
<p>//Set the URL<br />
curl_setopt($ch, CURLOPT_URL, $whaturl);</p>
<p>//Execute the fetch<br />
$data = curl_exec($ch);</p>
<p>//Close the connection<br />
curl_close($ch);<br />
$xml = new SimpleXMLElement($data);<br />
$fb = $xml-&gt;feed-&gt;entry['circulation'];<br />
echo $fb;<br />
//end get cool feedburner count<br />
?&gt;</p></blockquote>
<h2>显示 twitter 数</h2>
<p>新建 twitter.php</p>
<blockquote><p>&lt;?php<br />
$tw = get_option(&#8220;twitterfollowerscount&#8221;);<br />
if ($tw['lastcheck'] &lt; ( mktime() %u2013 3600 ) )<br />
{<br />
$xml=file_get_contents(&#8216;http://twitter.com/users/show.xml?screen_name=wpbeginner&#8217;);<br />
if (preg_match(&#8216;/followers_count&gt;(.*)&lt;/&#8217;,$xml,$match)!=0) {<br />
$tw['count'] = $match[1];<br />
}<br />
$tw['lastcheck'] = mktime();<br />
update_option(&#8220;twitterfollowerscount&#8221;,$tw);<br />
}<br />
echo $tw['count'];<br />
?&gt;</p></blockquote>
<p>在需要的地方 include</p>
<p><code>&lt;?php include("twitter.php"); ?&gt;</code></p>
<h2>10分钟后文章才出现在 feed 中</h2>
<blockquote><p>function publish_later_on_feed($where) {<br />
global $wpdb;</p>
<p>if ( is_feed() ) {<br />
// timestamp in WP-format<br />
$now = gmdate(&#8216;Y-m-d H:i:s&#8217;);</p>
<p>// value for wait;   device<br />
$wait = &#8217;10&#8242;; // integer</p>
<p>// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff<br />
$device = &#8216;MINUTE&#8217;; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR</p>
<p>// add SQL-sytax to default $where<br />
$where .= &#8221; AND TIMESTAMPDIFF($device, $wpdb-&gt;posts.post_date_gmt, &#8216;$now&#8217;) &gt; $wait &#8220;;<br />
}<br />
return $where;<br />
}</p>
<p>add_filter(&#8216;posts_where&#8217;, &#8216;publish_later_on_feed&#8217;);</p></blockquote>
<h2>随机显示头部图片</h2>
<p><code>&lt;img src="http://path_to_images/headerimage_&lt;?php echo(rand(1,3)); ?&gt;.gif"<br />
width="image_width" height="image_height" alt="image_alt_text" /&gt;</code></p>
<h2>设置文章过期时间</h2>
<p>自定义域 expiration 值的格式为 mm/dd/yyyy 00:00:00</p>
<blockquote><p>&lt;?php<br />
if (have_posts()) :<br />
while (have_posts()) : the_post(); ?&gt;<br />
$expirationtime = get_post_custom_values(&#8216;expiration&#8217;);<br />
if (is_array($expirationtime)) {<br />
$expirestring = implode($expirationtime);<br />
}</p>
<p>$secondsbetween = strtotime($expirestring)-time();<br />
if ( $secondsbetween &gt; 0 ) {<br />
// For example…<br />
the_title();<br />
the_excerpt();<br />
}<br />
endwhile;<br />
endif;<br />
?&gt;</p></blockquote>
<h2>删除数据库中的修订版本</h2>
<p>这样可以减少数据库的大小。在 phpmyadmin 的 wp 数据库执行 sql</p>
<p><code>DELETE FROM wp_posts WHERE post_type = "revision";</code></p>
<h2>让WP成为一个通讯录管理工具</h2>
<p><a href="http://www.cagintranet.com/archive/the-new-improved-way-to-turn-wordpress-27-into-a-membership-communit/">The New &amp; Improved Way to Turn WordPress 2.7 into a Membership Community</a></p>
<h2>页面卷边效果</h2>
<p><a href="http://www.hongkiat.com/blog/create-a-peel-away-effect-on-website-how-to/">create-a-peel-away-effect-on-website-how-to</a><br />
或者</p>
<p><a href="http://wordpress.org/extend/plugins/page-peel/">page-peel</a></p>
<h2>某些文章定制自己的样式表</h2>
<blockquote><p>&lt;?php if (is_single()) {<br />
$customstyle = get_post_meta($post-&gt;ID, &#8216;customstyle&#8217;, true);<br />
if (!empty($customstyle)) { ?&gt;<br />
&lt;style type=&#8221;text/css&#8221;&gt;<br />
&lt;?php echo $customstyle; ?&gt;<br />
&lt;style&gt;<br />
&lt;?php }<br />
} ?&gt;</p></blockquote>
<h2>根据类别定制 header和sidebar</h2>
<blockquote><p>&lt;?php if (is_category(&#8216;Blogging&#8217;)) {<br />
get_header(&#8216;blogging&#8217;);<br />
} else {<br />
get_header();<br />
} ?&gt;</p></blockquote>
<p>将会采用  header-blogging.php</p>
<blockquote><p>&lt;?php if (is_category(&#8216;Blogging&#8217;)) {<br />
get_sidebar(&#8216;blogging&#8217;);<br />
} else {<br />
get_sidebar();<br />
} ?&gt;</p></blockquote>
<p>将会采用  sidebar-blogging.php</p>
<h2>定制自己的登录界面</h2>
<p><a href="http://www.wpbeginner.com/showcase/best-of-best-wordpress-custom-login-page-designs/">Best of Best WordPress Custom Login Page Designs</a></p>
<h2>定制rss footer</h2>
<p><a href="http://yoast.com/wordpress/rss-footer/">rss footer</a></p>
<h2>关掉留言的html</h2>
<blockquote><p>// This will occur when the comment is posted<br />
function plc_comment_post( $incoming_comment ) {</p>
<p>// convert everything in a comment to display literally<br />
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);</p>
<p>// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam<br />
$incoming_comment['comment_content'] = str_replace( &#8220;&#8216;&#8221;, &#8216;&amp;apos;&#8217;, $incoming_comment['comment_content'] );</p>
<p>return( $incoming_comment );<br />
}</p>
<p>// This will occur before a comment is displayed<br />
function plc_comment_display( $comment_to_display ) {</p>
<p>// Put the single quotes back in<br />
$comment_to_display = str_replace( &#8216;&amp;apos;&#8217;, &#8220;&#8216;&#8221;, $comment_to_display );</p>
<p>return $comment_to_display;</p></blockquote>
<h2>特定类别的最新条目</h2>
<blockquote><p>&lt;?php<br />
query_posts(&#8216;showposts=1&amp;cat=3&#8242;);<br />
while(have_posts()) : the_post();<br />
?&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;h3&gt;&lt;a href=&#8221;&lt;?php the_permalink() ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;</p>
<p>&lt;ul&gt;&lt;li&gt;&lt;?php the_content(); ?&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;?php endwhile; ?&gt;</p></blockquote>
<h2>控制摘要长度</h2>
<blockquote><p>// Changing excerpt length<br />
function new_excerpt_length($length) {<br />
return 100;<br />
}<br />
add_filter(&#8216;excerpt_length&#8217;, &#8216;new_excerpt_length&#8217;);</p>
<p>// Changing excerpt more<br />
function new_excerpt_more($more) {<br />
return &#8216;%u2026&#8242;;<br />
}<br />
add_filter(&#8216;excerpt_more&#8217;, &#8216;new_excerpt_more&#8217;);</p></blockquote>
<h2>在个人页面显示twitter facebook信息</h2>
<p>在 functions.php 添加</p>
<blockquote><p>&lt;?php<br />
function my_new_contactmethods( $contactmethods ) {<br />
// Add Twitter<br />
$contactmethods['twitter'] = &#8216;Twitter&#8217;;<br />
//add Facebook<br />
$contactmethods['facebook'] = &#8216;Facebook&#8217;;</p>
<p>return $contactmethods;<br />
}<br />
add_filter(&#8216;user_contactmethods&#8217;,'my_new_contactmethods&#8217;,10,1);<br />
?&gt;</p></blockquote>
<p>在 author.php 加入</p>
<p><code>&lt;?php echo $curauth-&gt;twitter; ?&gt;</code></p>
<h2>导航菜单</h2>
<p><a href="http://mtekk.weblogs.us/code/breadcrumb-navxt/">breadcrumb</a></p>
<h2>自定义显示留言</h2>
<blockquote><p>&lt;?php<br />
$query = &#8220;SELECT * from $wpdb-&gt;comments WHERE comment_approved= &#8217;1&#8242;<br />
ORDER BY comment_date DESC LIMIT 0 ,5&#8243;;<br />
$comments = $wpdb-&gt;get_results($query);</p>
<p>if ($comments) {<br />
echo &#8216;&lt;ul&gt;&#8217;;<br />
foreach ($comments as $comment) {<br />
$url = &#8216;&lt;a href=&#8221;&#8216;. get_permalink($comment-&gt;comment_post_ID).&#8217;#comment-&#8217;.$comment-&gt;comment_ID .&#8217;&#8221; title=&#8221;&#8216;.$comment-&gt;comment_author .&#8217; | &#8216;.get_the_title($comment-&gt;comment_post_ID).&#8217;&#8221;&gt;&#8217;;<br />
echo &#8216;&lt;li&gt;&#8217;;<br />
echo &#8216;&lt;div&gt;&#8217;;<br />
echo $url;<br />
echo get_avatar( $comment-&gt;comment_author_email, $img_w);<br />
echo &#8216;&lt;/a&gt;&lt;/div&gt;&#8217;;</p>
<p>echo &#8216;&lt;div&gt;Par: &#8216;;<br />
echo $url;<br />
echo $comment-&gt;comment_author;<br />
echo &#8216;&lt;/a&gt;&lt;/div&gt;&#8217;;<br />
echo &#8216;&lt;/li&gt;&#8217;;<br />
}<br />
echo &#8216;&lt;/ul&gt;&#8217;;<br />
}<br />
?&gt;</p></blockquote>
<h2>根据 refer 欢迎</h2>
<p><a href="http://wordpress.org/extend/plugins/wp-greet-box/">wp-greet-box</a></p>
<h2>留言转向页面</h2>
<p><a href="http://wordpress.org/extend/plugins/comment-redirect/">comment-redirect</a></p>
<h2>WP SEO</h2>
<p><a href="http://www.wpbeginner.com/beginners-guide/must-see-seo-guide-for-all-wordpress-bloggers/">WP SEO</a></p>
<h2>文章发送邮件</h2>
<p><a href="http://lesterchan.net/wordpress/readme/wp-email.html">wp-email</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/wordprees-%e9%ab%98%e7%ba%a7%e6%8a%80%e5%b7%a7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>国外 wordpress 主题欣赏</title>
		<link>http://pensee.net.cn/%e5%9b%bd%e5%a4%96-wordpress-%e4%b8%bb%e9%a2%98%e6%ac%a3%e8%b5%8f</link>
		<comments>http://pensee.net.cn/%e5%9b%bd%e5%a4%96-wordpress-%e4%b8%bb%e9%a2%98%e6%ac%a3%e8%b5%8f#comments</comments>
		<pubDate>Tue, 19 Jan 2010 05:11:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pensee.net.cn/?p=631</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://ma.tt/"><img src="http://pensee.net.cn/wp-content/themes/pengxun/wp-gallery2010-01-19/matt.jpg" alt="wordpress theme" /></a></p>
<p><a href="http://www.jayhafling.com/"><img src="http://pensee.net.cn/wp-content/themes/pengxun/wp-gallery2010-01-19/jayhafling.jpg" alt="wordpress theme" /></a></p>
<p><a href="http://www.kulturbanause.de/"><img src="http://pensee.net.cn/wp-content/themes/pengxun/wp-gallery2010-01-19/kulturbanause.jpg" alt="wordpress theme" /></a></p>
<p><a href="http://www.bcandullo.com/"><img src="http://pensee.net.cn/wp-content/themes/pengxun/wp-gallery2010-01-19/bcandullo.jpg" alt="wordpress theme" /></a></p>
<p><a href="http://www.ilovecolors.com.ar/"><img src="http://pensee.net.cn/wp-content/themes/pengxun/wp-gallery2010-01-19/ilovecolors.jpg" alt="wordpress theme" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/%e5%9b%bd%e5%a4%96-wordpress-%e4%b8%bb%e9%a2%98%e6%ac%a3%e8%b5%8f/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress 过滤某个类别</title>
		<link>http://pensee.net.cn/wordpress-%e8%bf%87%e6%bb%a4%e6%9f%90%e4%b8%aa%e7%b1%bb%e5%88%ab</link>
		<comments>http://pensee.net.cn/wordpress-%e8%bf%87%e6%bb%a4%e6%9f%90%e4%b8%aa%e7%b1%bb%e5%88%ab#comments</comments>
		<pubDate>Mon, 18 Jan 2010 10:11:54 +0000</pubDate>
		<dc:creator>guoshuang</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pensee.net.cn/?p=626</guid>
		<description><![CDATA[17 这个类别不在 feed home search 结果中出现。在 themes 的 function.php 中加入 &#60;?php function asidesFilter($query) { if ($query-&#62;is_feed &#124;&#124; $query-&#62;is_home &#124;&#124; $query-&#62;is_search) { $query-&#62;set('cat','-17'); } return $query; } add_filter('pre_get_posts','asidesFilter'); ?&#62; 注意：前后都不要有空格，否则会出现错误。]]></description>
			<content:encoded><![CDATA[<p>17 这个类别不在 feed home search 结果中出现。在 themes 的 function.php 中加入</p>
<p><code>&lt;?php<br />
function asidesFilter($query) {<br />
if ($query-&gt;is_feed || $query-&gt;is_home || $query-&gt;is_search) {<br />
$query-&gt;set('cat','-<strong><em>17</em></strong>');<br />
}<br />
return $query;<br />
}<br />
add_filter('pre_get_posts','asidesFilter');<br />
?&gt;</code></p>
<p>注意：前后都不要有空格，否则会出现错误。</p>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/wordpress-%e8%bf%87%e6%bb%a4%e6%9f%90%e4%b8%aa%e7%b1%bb%e5%88%ab/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>改进 WordPress 搜索结果</title>
		<link>http://pensee.net.cn/%e6%94%b9%e8%bf%9b-wordpress-%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c</link>
		<comments>http://pensee.net.cn/%e6%94%b9%e8%bf%9b-wordpress-%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c#comments</comments>
		<pubDate>Mon, 18 Jan 2010 10:04:03 +0000</pubDate>
		<dc:creator>guoshuang</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pensee.net.cn/?p=621</guid>
		<description><![CDATA[显示搜索结果的数量 &#60;h2&#62;Search Result for &#60;?php /* Search Count */ $allsearch = &#38;new WP_Query("s=$s&#38;showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch-&#62;post_count; _e(''); _e('&#60;span&#62;'); echo $key; _e('&#60;/span&#62;'); _e(' &#38;mdash; '); echo $count . ' '; _e('articles'); wp_reset_query(); ?&#62;&#60;/h2&#62; 着重显示搜索关键字 &#60;h3 id="post-&#60;?php the_ID(); ?&#62;"&#62; &#60;a href="&#60;?php the_permalink() ?&#62;" rel="bookmark" title="Permanent Link to &#60;?php the_title_attribute(); ?&#62;"&#62; &#60;?php the_title(); ?&#62;&#60;/a&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>显示搜索结果的数量</p>
<pre>&lt;h2&gt;Search Result for
&lt;?php /* Search Count */
$allsearch = &amp;new WP_Query("s=$s&amp;showposts=-1");
$key = wp_specialchars($s, 1);
$count = $allsearch-&gt;post_count;
_e('');
_e('&lt;span&gt;');
echo $key;
_e('&lt;/span&gt;');
_e(' &amp;mdash; ');
 echo $count . ' ';
 _e('articles');
wp_reset_query(); ?&gt;&lt;/h2&gt;</pre>
<p>着重显示搜索关键字</p>
<pre>&lt;h3 id="post-&lt;?php the_ID(); ?&gt;"&gt;
&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to
&lt;?php the_title_attribute(); ?&gt;"&gt;
&lt;?php the_title(); ?&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;?php $title = get_the_title();
$keys= explode(" ",$s);
$title = preg_replace('/('.implode('|', $keys) .')/iu', '&lt;strong&gt;\0&lt;/strong&gt;', $title); ?&gt;
&lt;?php echo $title; ?&gt;</pre>
<p>过滤某个类别不加入搜索</p>
<pre>&lt;?php
function SearchFilter($query) {
if ($query-&gt;is_search) {
$query-&gt;set('cat','8,15');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/%e6%94%b9%e8%bf%9b-wordpress-%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 技巧</title>
		<link>http://pensee.net.cn/wordpress-%e6%8a%80%e5%b7%a7</link>
		<comments>http://pensee.net.cn/wordpress-%e6%8a%80%e5%b7%a7#comments</comments>
		<pubDate>Mon, 28 Dec 2009 14:29:07 +0000</pubDate>
		<dc:creator>guoshuang</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://pensee.net.cn/?p=437</guid>
		<description><![CDATA[不用插件加入 Gravatar 头像 在 comments 模板找到下面这句 &#60;li class=”&#60;?php echo $oddcomment; ?&#62;” id=”comment-&#60; ?php comment_ID() ?&#62;”&#62;&#60;/li&#62; 加入下面代码 &#60;?php if(!empty($comment -&#62; comment_author_email)) { $md5 = md5($comment -&#62; comment_author_email); $default = urlencode('默认头像的地址'); echo "&#60;img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&#38;size=20&#38;default=$default' alt='' /&#62;"; } ?&#62; 调整 默认头像的地址 为你站点默认头像图片的地址。 显示你自己的 “更多内容” 打开 index.php 或者其它 home php，找到 &#60;?php the_content(__(’Read more’));?&#62; 改为 &#60;?php the_content(”更多内容” . the_title(”,”,false), 0); [...]]]></description>
			<content:encoded><![CDATA[<h2>不用插件加入 Gravatar 头像</h2>
<p>在 comments 模板找到下面这句</p>
<p><code>&lt;li class=”&lt;?php echo $oddcomment; ?&gt;” id=”comment-&lt; ?php comment_ID() ?&gt;”&gt;&lt;/li&gt;</code></p>
<p>加入下面代码</p>
<p><code><br />
&lt;?php if(!empty($comment -&gt; comment_author_email)) {<br />
$md5 = md5($comment -&gt; comment_author_email);<br />
$default = urlencode('默认头像的地址');<br />
echo "&lt;img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=20&amp;default=$default' alt='' /&gt;";<br />
}<br />
?&gt;<br />
</code></p>
<p>调整 <strong>默认头像的地址</strong> 为你站点默认头像图片的地址。</p>
<h2>显示你自己的 “更多内容”</h2>
<p>打开 index.php 或者其它 home php，找到</p>
<p><code>&lt;?php the_content(__(’Read more’));?&gt;</code></p>
<p>改为</p>
<p><code>&lt;?php the_content(”更多内容” . the_title(”,”,false), 0); ?&gt;</code></p>
<h2>字符串过滤</h2>
<p><code>&lt;?php echo wp_specialchars($s, 1); ?&gt;</code></p>
<h2>避免蜘蛛抓取 archive 页面</h2>
<p>在 header.php 的  head 区域加入</p>
<p><code>&lt;?php if(is_archive()) { ?&gt;&lt;meta name=”robots” content=”noindex”&gt;&lt;?php } ?&gt;</code></p>
<h3>基本参考</h3>
<ul>
<li><a href="http://codex.wordpress.org/Main_Page">WordPress Documentation (Codex)</a></li>
<li><a href="http://wordpress.org/extend/plugins/">WordPress.org Plugins Database</a></li>
<li><a href="http://themes.wordpress.net/">WordPress.net Themes Database / Viewer</a></li>
<li><a href="http://wordpress.org/support/">WordPress Support Forums</a></li>
<li><a href="http://www.wpdesigner.com/forums/">Wpdesigner Theme Support</a></li>
</ul>
<h3>相关参考</h3>
<ul>
<li><a href="http://kahi.cz/wordpress/wordpress-cheatsheets-summarized/">WordPress Cheat Sheets Summary by Kahi.cz</a></li>
<li><a href="http://mashable.com/category/wordpress-tips">Mashable WordPress Resource Lists</a></li>
<li><a href="http://weblogtoolscollection.com/archives/category/wordpress-tips/">Weblog Tools Collection Tips and Tutorials</a></li>
<li><a href="http://wpbits.wordpress.com/tag/wordpress-tips/">WP Bits WordPress Tips</a></li>
<li><a href="http://www.binarymoon.co.uk/search/wordpress+tips">Binary Moon Tips</a></li>
<li><a href="http://www.smashingmagazine.com/2007/06/29/wordpress-plugins-tutorials-your-pick/">WordPress Plugins &amp; Tutorials at Smashing Magazine</a></li>
<li><a href="http://wordpressgarage.com/category/wordpress-as-cms/">WordPress Garage &#8211; WordPress as CMS tips</a></li>
<li><a href="http://www.tamba2.org.uk/wordpress/">The Tamba2 WordPress Guides by Podz</a></li>
</ul>
<h3>Individual Plugin Authors</h3>
<ul>
<li><a href="http://lesterchan.net/portfolio/programming.php">Plugins by Lester Chan</a></li>
<li><a href="http://urbangiraffe.com/plugins/">Plugins by John Godley</a></li>
<li><a href="http://alexking.org/projects/wordpress">AlexKing.org Plugins</a></li>
</ul>
<h3>高级技巧</h3>
<ul>
<li><a href="http://www.davidairey.com/customize-your-wordpress-login/"><strong>Customize Your WordPress Login</strong></a> &#8211; David Airey shows you how to personalize your login page.</li>
<li><a href="http://www.devlounge.net/extras/how-to-write-a-wordpress-plugin"><strong>How to Write A Plugin</strong></a> &#8211; A series of twelve entries on how to write your first WordPress plugin, from DevLounge.</li>
<li><a href="http://bloghelper.is-there.net/integrating-a-forum-with-wordpress/"><strong>Integrating A Forum With WordPress</strong></a> &#8211; Learn how to mesh your WordPress and vBulletin, SMF, bbPress, or Vanilla and etcetera.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/wordpress-%e6%8a%80%e5%b7%a7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple wordpress themes design</title>
		<link>http://pensee.net.cn/simple-wordpress-themes-design</link>
		<comments>http://pensee.net.cn/simple-wordpress-themes-design#comments</comments>
		<pubDate>Sat, 28 Nov 2009 09:58:42 +0000</pubDate>
		<dc:creator>guoshuang</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://127.0.1.1/?p=66</guid>
		<description><![CDATA[网址：Simple wordpress themes 时间：2008年12月]]></description>
			<content:encoded><![CDATA[<div class="webLayoutShow">
<img src="/wp-content/themes/pengxun/designs/simplewordpressthemes01.png" alt="Simple wordpress themes desgin" /><img src="/wp-content/themes/pengxun/designs/simplewordpressthemes02.png" alt="Simple wordpress themes desgin" />
</div>
<ul>
<li>网址：<a href="http://simplewordpresstheme.com/">Simple wordpress themes</a></li>
<li>时间：2008年12月</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://pensee.net.cn/simple-wordpress-themes-design/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

