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

<channel>
	<title>WordPress &#8211; 中原驿站</title>
	<atom:link href="https://hzy.pw/p/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>https://hzy.pw</link>
	<description>Here is my stage.</description>
	<lastBuildDate>Thu, 09 Mar 2017 14:49:06 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>

<image>
	<url>https://hzy.pw/wp-content/uploads/2015/09/cropped-zyyz-32x32.png</url>
	<title>WordPress &#8211; 中原驿站</title>
	<link>https://hzy.pw</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">122031623</site>	<item>
		<title>基于 WordPress 的个人笔记系统解决方案</title>
		<link>https://hzy.pw/p/2189</link>
					<comments>https://hzy.pw/p/2189#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 14:20:09 +0000</pubDate>
				<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[推荐阅读]]></category>
		<category><![CDATA[笔记]]></category>
		<guid isPermaLink="false">https://hzy.pw/?p=2189</guid>

					<description><![CDATA[我的个人笔记系统已搭建完毕，欢迎来访。 猿猿笔迹：http://note.hzy.pw 一切的源头都是 为知笔 <a class="read-more" href="https://hzy.pw/p/2189">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<blockquote><p><span style="color: #800080;">我的个人笔记系统已搭建完毕，欢迎来访。</span></p>
<p><span style="color: #800080;"><strong>猿猿笔迹：<a style="color: #800080;" href="http://note.hzy.pw" target="_blank">http://note.hzy.pw</a></strong></span></p></blockquote>
<p>一切的源头都是 <a href="https://hzy.pw/p/2159">为知笔记宣布不再免费</a>，不过我作为一个用户，虽然不开心但也没啥办法，想要转移到印象或者又到最终都还是放弃了，一是功能都略有不足，二是害怕为知笔记这样的事情再次发生，再次成为公司抛弃的免费用户。<span id="more-2189"></span></p>
<p>在为之的有关社区交流之后，我了解到了 Leanote (<a href="https://github.com/leanote/leanote" target="_blank">https://github.com/leanote/leanote</a>)，是一个印象笔记的开源实现，国人开发，还是很不错的。试用之后，各方面都显得有一些不够成熟，不够好用，没有安卓 App 是个痛点，最最关键的是同步功能有问题，同步显示成功其实根本就没成功，这就让我不能忍了。。。果断弃了。<img decoding="async" class="size-full wp-image-1748 alignnone" src="https://hzy.pw/wp-content/uploads/2015/09/xi19.gif" alt="" width="50" height="50" /></p>
<p>不过 Leanote 有一个相当强大的博客系统，可以选择指定的分类作为 “公开的博客”，这一功能作为想建立一个个人知识库的我来说，无疑是锦上添花，能让自己收集的好笔记分享给众人，是一个相当棒的事情。</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-2194" src="https://hzy.pw/wp-content/uploads/2017/01/01300000316692123253624037062_s.jpg" alt="" width="300" height="300" srcset="https://hzy.pw/wp-content/uploads/2017/01/01300000316692123253624037062_s.jpg 300w, https://hzy.pw/wp-content/uploads/2017/01/01300000316692123253624037062_s-150x150.jpg 150w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<blockquote><p>有一天我突发奇想，<span style="background-color: #ffff99;">完全可以用 WordPress 来搭建一个笔记系统呀！所谓的 <strong>标签、多级目录、搜索、笔记编辑、历史回滚</strong>，都直接内置了。</span>而 <strong>Markdown、私密目录</strong> 这样的功能，都可以由插件实现！</p></blockquote>
<p><img decoding="async" class="size-full wp-image-1744 alignnone" src="https://hzy.pw/wp-content/uploads/2015/09/xi14.gif" alt="" width="50" height="50" />于是乎，就有了现在的猿猿笔迹（<a href="http://note.hzy.pw" target="_blank">note.hzy.pw</a>）</p>
<p><a href="http://note.hzy.pw" target="_blank"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2195" src="https://hzy.pw/wp-content/uploads/2017/01/screenshot-note.hzy_.pw-2017-01-09-21-13-14.png" alt="" width="777" height="421" srcset="https://hzy.pw/wp-content/uploads/2017/01/screenshot-note.hzy_.pw-2017-01-09-21-13-14.png 777w, https://hzy.pw/wp-content/uploads/2017/01/screenshot-note.hzy_.pw-2017-01-09-21-13-14-300x163.png 300w, https://hzy.pw/wp-content/uploads/2017/01/screenshot-note.hzy_.pw-2017-01-09-21-13-14-768x416.png 768w" sizes="auto, (max-width: 777px) 100vw, 777px" /></a></p>
<p>实施这个方案的第一步是写了个 Node 程序，调用 node-wordpress 库，将为之导出的 html 文件读取并提取正文后，用发表文章的 API 发布到了博客中。代码也就百行，没必要贴出来了。</p>
<p>目前对于我而言，是一个完美的笔记系统解决方案，在安卓上可以直接使用 WordPress 提供的 App 随手写一点新笔记，功能上不输给一个专用的笔记软件：</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2204" src="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-08-10-33.png" alt="" width="250" height="444" srcset="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-08-10-33.png 250w, https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-08-10-33-169x300.png 169w" sizes="auto, (max-width: 250px) 100vw, 250px" /> <img loading="lazy" decoding="async" class="alignnone size-full wp-image-2205" src="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-28-41.png" alt="" width="250" height="444" srcset="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-28-41.png 250w, https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-28-41-169x300.png 169w" sizes="auto, (max-width: 250px) 100vw, 250px" /> <img loading="lazy" decoding="async" class="alignnone size-full wp-image-2206" src="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-29-16.png" alt="" width="250" height="444" srcset="https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-29-16.png 250w, https://hzy.pw/wp-content/uploads/2017/01/Screenshot_2017-01-11-12-29-16-169x300.png 169w" sizes="auto, (max-width: 250px) 100vw, 250px" /></p>
<h2>电脑端</h2>
<p>而在电脑上，我使用 <a href="http://openlivewriter.org/" target="_blank">Open Live Writer</a> 发表博客，这是一个开源软件，在 2012 年 Window Live Writer 停止更新之后持续维护至今。<a href="https://hzy.pw/p/69">后者很好用</a>，所以前者肯定也不会更差。</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2197" src="https://hzy.pw/wp-content/uploads/2017/01/无标题.jpg" alt="" width="741" height="470" srcset="https://hzy.pw/wp-content/uploads/2017/01/无标题.jpg 741w, https://hzy.pw/wp-content/uploads/2017/01/无标题-300x190.jpg 300w" sizes="auto, (max-width: 741px) 100vw, 741px" /></p>
<p>使用客户端的原因是可以直接粘贴本地的图片，在线的编辑器不行。其他倒没什么差异。</p>
<h2>WP 插件</h2>
<p>为了让 WordPress 变成为知笔记，我装了不少的插件，每一个都是精心挑选，非常的有用。</p>
<p><strong>Advanced Excerpt</strong></p>
<p>设置文章的自动摘要，为之导出的笔记头部带 style 标签，直接输出到页面上会使整个页面的样式崩掉。用这个插件设置摘要的长度为 0 就没问题了。</p>
<p><strong>Ajax Search Lite</strong></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2199" src="https://hzy.pw/wp-content/uploads/2017/01/QQ图片20170109211806-副本.png" alt="" width="381" height="550" srcset="https://hzy.pw/wp-content/uploads/2017/01/QQ图片20170109211806-副本.png 381w, https://hzy.pw/wp-content/uploads/2017/01/QQ图片20170109211806-副本-208x300.png 208w" sizes="auto, (max-width: 381px) 100vw, 381px" /></p>
<p>增强博客本身的搜索功能，Ajax 显示结果十分的高效。需要好好设置一下不然可能会泄露隐藏的笔记内容。</p>
<p><strong>Code Prettify</strong></p>
<p>非常好用的插件，自动将页面中的 &lt;code&gt; 标签染上色，无需多余的设置和多余的发布步骤，配合 Markdown 使用绝佳。</p>
<p><strong>Jetpack</strong></p>
<p>WP 官方的插件集合，我主要用了当中的防暴力破解、无限滚动加载和 Markdown 功能。</p>
<p><strong>QQWorld 自动保存图片</strong></p>
<p>自动保存远程图片到本地，我经常剪藏网络上的文章，这个插件就很有用了。</p>
<p><strong>Restrict User Access</strong></p>
<p>必装，设置用户权限，从底层控制普通访客的访问权限，同类插件当中最好用的一款。</p>
<p><strong>Table of Contents Plus</strong></p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-2200 size-medium" src="https://hzy.pw/wp-content/uploads/2017/01/无标题-1-300x130.jpg" width="300" height="130" srcset="https://hzy.pw/wp-content/uploads/2017/01/无标题-1-300x130.jpg 300w, https://hzy.pw/wp-content/uploads/2017/01/无标题-1.jpg 745w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>
<p>自动为每篇文章提取目录。</p>
<p><strong>WP Attachments</strong></p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-2201" src="https://hzy.pw/wp-content/uploads/2017/01/无标题-2.jpg" width="550" height="220" srcset="https://hzy.pw/wp-content/uploads/2017/01/无标题-2.jpg 962w, https://hzy.pw/wp-content/uploads/2017/01/无标题-2-300x120.jpg 300w, https://hzy.pw/wp-content/uploads/2017/01/无标题-2-768x307.jpg 768w" sizes="auto, (max-width: 550px) 100vw, 550px" /></p>
<p>非常完善的文章附件管理插件。</p>
<hr />
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1765" src="https://hzy.pw/wp-content/uploads/2015/09/xi37.gif" alt="" width="50" height="50" /></p>
<p><strong><span style="color: #339966;">这就是我的个人笔记系统解决方案，感谢阅读到最后。</span></strong></p>
<p>猿猿笔迹我将主要用来转载自己所感兴趣的各种内容，欢迎大家前来阅读：<a href="http://note.hzy.pw/" target="_blank">http://note.hzy.pw/</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/2189/feed</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2189</post-id>	</item>
		<item>
		<title>WordPress Theme Germ</title>
		<link>https://hzy.pw/p/1933</link>
					<comments>https://hzy.pw/p/1933#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Mon, 29 Feb 2016 12:00:54 +0000</pubDate>
				<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[Germ]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://hzy.pw/?p=1933</guid>

					<description><![CDATA[我认为个人博客是一个展示自己的平台，拥有简单清晰的布局和美观华丽的界面。 以此为目的，我创作了 Germ, 希 <a class="read-more" href="https://hzy.pw/p/1933">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>我认为个人博客是一个展示自己的平台，拥有简单清晰的布局和美观华丽的界面。<br />
以此为目的，我创作了 Germ, 希望大家能喜欢。</p>
<p><span id="more-1933"></span></p>
<h2 id="-">相关链接</h2>
<p>本主题采用 Github 托管并保持持续更新，<span style="color: #3366ff;"><strong>更多相关信息及详细介绍请访问：<a style="color: #3366ff;" href="https://github.com/h2y/germ" target="_blank">https://github.com/h2y/germ</a></strong></span></p>
<p>一键下载 Germ 最新版本：<a href="https://github.com/h2y/germ/archive/master.zip" target="_blank">https://github.com/h2y/germ/archive/master.zip</a></p>
<p>如果你有好的建议欢迎在 <a href="https://github.com/h2y/germ/issues" target="_blank">issue</a> 中提交，我会尽力改善，如果没有 Github 账号也可以在本页下方直接留言。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/1933/feed</wfw:commentRss>
			<slash:comments>67</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1933</post-id>	</item>
		<item>
		<title>博客新主题开发感想</title>
		<link>https://hzy.pw/p/1943</link>
					<comments>https://hzy.pw/p/1943#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Sat, 20 Feb 2016 14:40:19 +0000</pubDate>
				<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[中原驿站]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[开发]]></category>
		<category><![CDATA[我的网站]]></category>
		<category><![CDATA[推荐阅读]]></category>
		<guid isPermaLink="false">http://hzy.pw/?p=1943</guid>

					<description><![CDATA[经过 10 天的修修补补, 今天终于为中原驿站上线了一套崭新的皮肤, 取名为 Germ. Germ 是 &#8 <a class="read-more" href="https://hzy.pw/p/1943">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>经过 10 天的修修补补, 今天终于为中原驿站上线了一套崭新的皮肤, 取名为 Germ.</p>
<p>Germ 是 <span style="color: #99cc00;">&#8220;萌芽/起源&#8221;</span> 的意思, 对于我来说, 这不仅是我的真正意义上第一款 WP 主题, 也是我在 Github 上开源的第一个项目. 下面是我对此次开发的一些感想.<span id="more-1943"></span></p>
<h2><span style="color: #ff6600;">样式展示</span></h2>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528.jpg" rel="attachment wp-att-1945"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1945" src="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528.jpg" alt="QQ截图20160220211528" width="1902" height="974" srcset="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528.jpg 1902w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528-300x154.jpg 300w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528-768x393.jpg 768w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220211528-1024x524.jpg 1024w" sizes="auto, (max-width: 1902px) 100vw, 1902px" /></a></p>
<p>改版之前的样子也截了图, 可以参看这篇文章: &lt;<a href="https://hzy.pw/p/1926" target="_blank">网站大改版前的纪念</a>&gt;</p>
<p>Github 项目地址: <a href="https://github.com/h2y/germ" target="_blank">https://github.com/h2y/germ</a></p>
<p>在这之后, 我毫无疑问会将此主题作为一个个人的产品推广出去, 敬请期待.</p>
<h2><span style="color: #ff6600;">修改来自 Quench 主题</span></h2>
<p>这个主题并不是我原创, 是找的这个 Quench 主题, 然后再自己进行一些修改, 使它变得更完善更棒.</p>
<p>只是&#8230; 我需要做的修改比我想象的要多得多, 以至于花了 10 天的时间才勉强完成, 比如修正 <span style="color: #666699;"><em>&#8220;关闭评论的文章仍然会显示评论框&#8221;</em></span> 这种尴尬的问题.</p>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647.jpg" rel="attachment wp-att-1947"><img loading="lazy" decoding="async" class="aligncenter wp-image-1947" src="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647.jpg" alt="QQ截图20160220220647" width="500" height="197" srcset="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647.jpg 1481w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647-300x118.jpg 300w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647-768x303.jpg 768w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160220220647-1024x404.jpg 1024w" sizes="auto, (max-width: 500px) 100vw, 500px" /></a></p>
<p>以至于我这 10 天做出的 commits 数量便超过了原作者的两倍&#8230;&#8230;</p>
<p>其实我越改, 越觉得之前用的 ZaLive 主题是有多么的优秀, 代码写的相当相当的完善, 界面也很好看, 可我就是看够了必须得要换了, 毕竟 2 年了. (Github: <a href="https://github.com/zenoven/zalive" target="_blank">zenoven/zalive</a>)</p>
<p>但还是感谢原作者 <em>mastermay</em> 提供了这么漂亮的一个主题, 集成的各种功能也是非常的不错.</p>
<p><span style="color: #008000;">如果我以后要编写下一个 WP 主题, 毫无疑问我会使用 WP 官方主题作为起点.</span> 虽然丑了点, 但代码写的漂亮啊, 注释也齐全.</p>
<h2><span style="color: #ff6600;">第一次使用 Github</span></h2>
<p>之前自己在本地就一直用 Git 作为版本控制, 但这次才转到了线上 &#8212;- 世界最大的 ?? 交友网站 Github. 不过之前都是很简单地使用, 而通过这次开发主题, 仔细了解了 Github 的 <em>Pull Request / Issues / Fork / Rebase</em> 这些东西后, 才算是真正明白了 Git 的强大.</p>
<p><span style="color: #800080;">最重要的是能有一个展示自己作品和与大神们交流的平台, 感觉太棒.</span></p>
<h2><span style="color: #ff6600;">之后</span></h2>
<p>之后要做的东西还相当相当多&#8230;</p>
<p>我是用一个记事本记录需要进行的开发工作的, 在测试主题时, 每发现一个需要修正的问题, 就写在记事本中新的一行, 每解决一个问题, 就将其删掉.</p>
<p><span style="color: #008080;">但是, 在解决一个问题时, 往往会发现更多的问题, 导致列表反而越来越长</span> -.-||</p>
<p>直到现在, 列表中还有 12 行, 当然这基本都不是 bug, 是一些突发奇想想到的点子, 所以我在将来是有事干的&#8230;&#8230;</p>
<p><a href="https://hzy.pw/wp-content/uploads/2015/09/xi21.gif" rel="attachment wp-att-1750"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1750" src="https://hzy.pw/wp-content/uploads/2015/09/xi21.gif" alt="xi21" width="50" height="50" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/1943/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1943</post-id>	</item>
		<item>
		<title>网站大改版前的纪念</title>
		<link>https://hzy.pw/p/1926</link>
					<comments>https://hzy.pw/p/1926#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Tue, 09 Feb 2016 11:08:58 +0000</pubDate>
				<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[中原驿站]]></category>
		<category><![CDATA[我的网站]]></category>
		<guid isPermaLink="false">http://hzy.pw/?p=1926</guid>

					<description><![CDATA[我的中原驿站从 13 年建站到现在，使用的一直是黑绿配色的扁平风格。基于 ZenOven 的 Zalive 主 <a class="read-more" href="https://hzy.pw/p/1926">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>我的中原驿站从 13 年建站到现在，使用的一直是黑绿配色的扁平风格。基于 ZenOven 的 <a href="https://github.com/zenoven/zalive" target="_blank">Zalive</a> 主题，并进行了大量的修改，感谢原作者提供这么优秀美观的主题，在一点一点修改他的主题的过程中，我也进步了不少。<span style="color: #339966;">（中原驿站更新历史：<a style="color: #339966;" href="https://hzy.pw/changelog" target="_blank">https://hzy.pw/changelog</a>）</span></p>
<p>不过现在已经面对着同样的界面 2 年多了，就算这种扁平风格依旧没有落伍，我作为站长也早就看够了，早就想要大改一番了，这肯定是这个寒假之内的事儿。</p>
<p><span style="color: #ffcc00;"><strong>但在这之前，我要对改造前的网站拍几张照，以作留念。</strong></span><span id="more-1926"></span></p>
<hr />
<p>&nbsp;</p>
<h3><span style="color: #003300;"><strong>这就是整体风格，黑绿配色：</strong></span></h3>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209180800_2345看图王.jpg" rel="attachment wp-att-1927"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1927" src="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209180800_2345看图王.jpg" alt="QQ截图20160209180800_2345看图王" width="888" height="441" srcset="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209180800_2345看图王.jpg 888w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209180800_2345看图王-300x149.jpg 300w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209180800_2345看图王-768x381.jpg 768w" sizes="auto, (max-width: 888px) 100vw, 888px" /></a></p>
<p>&nbsp;</p>
<h3><span style="color: #003300;"><strong>首页的快照及解说：</strong></span></h3>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage..jpg" rel="attachment wp-att-1929"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1929" src="https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage..jpg" alt="中原驿站   There is my stage." width="777" height="2186" srcset="https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage..jpg 777w, https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage.-107x300.jpg 107w, https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage.-768x2161.jpg 768w, https://hzy.pw/wp-content/uploads/2016/02/中原驿站-There-is-my-stage.-364x1024.jpg 364w" sizes="auto, (max-width: 777px) 100vw, 777px" /></a></p>
<p>&nbsp;</p>
<h3><span style="color: #003300;"><strong>留言板页面：</strong></span>（<a href="https://hzy.pw/liuyanban" target="_blank">https://hzy.pw/liuyanban</a>）</h3>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站.png" rel="attachment wp-att-1928"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1928" src="https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站.png" alt="驿站惊现留言板   中原驿站" width="777" height="1570" srcset="https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站.png 777w, https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站-148x300.png 148w, https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站-768x1552.png 768w, https://hzy.pw/wp-content/uploads/2016/02/驿站惊现留言板-中原驿站-507x1024.png 507w" sizes="auto, (max-width: 777px) 100vw, 777px" /></a></p>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
<p><strong>网站大改版之后会变成怎样，我也还不清楚，但一定是一个华丽、现代化的界面，敬请期待！</strong></p>
<p><a href="https://hzy.pw/wp-content/uploads/2015/09/xi14.gif" rel="attachment wp-att-1744"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1744" src="https://hzy.pw/wp-content/uploads/2015/09/xi14.gif" alt="xi14" width="50" height="50" /></a></p>
<p>·</p>
<p><a href="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701.jpg" rel="attachment wp-att-1931"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1931" src="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701.jpg" alt="QQ截图20160209190701" width="1139" height="182" srcset="https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701.jpg 1139w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701-300x48.jpg 300w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701-768x123.jpg 768w, https://hzy.pw/wp-content/uploads/2016/02/QQ截图20160209190701-1024x164.jpg 1024w" sizes="auto, (max-width: 1139px) 100vw, 1139px" /></a></p>
<p style="text-align: center;"><span style="color: #999999;">（↑ 这是原模板中，文章尾部区域的照片 ↑）</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/1926/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1926</post-id>	</item>
		<item>
		<title>WordPress文章中自动为站外链接添加nofollow属性</title>
		<link>https://hzy.pw/p/1640</link>
					<comments>https://hzy.pw/p/1640#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Sat, 22 Aug 2015 05:08:48 +0000</pubDate>
				<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[建站]]></category>
		<category><![CDATA[教程]]></category>
		<guid isPermaLink="false">http://hzy.pw/?p=1640</guid>

					<description><![CDATA[只需要在 function.php 中添加以下代码即可，同时自动添加 target=&#8221;_blank <a class="read-more" href="https://hzy.pw/p/1640">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>只需要在 <em>function.php</em> 中添加以下代码即可，同时自动添加 <span style="text-decoration: underline;">target=&#8221;_blank&#8221;</span>，如果链接中已有这两个属性，则不会重复添加。</p>
<p>我的这个版本不同于之前网上流传的那个版本，那个版本不知道是哪个菜鸟写的，虽然能实现功能，但那时间复杂度简直不能忍。。。<span id="more-1640"></span></p>
<style>.syntaxhighlighter a,.syntaxhighlighter code,.syntaxhighlighter div,.syntaxhighlighter table,.syntaxhighlighter table caption,.syntaxhighlighter table tbody,.syntaxhighlighter table td,.syntaxhighlighter table thead,.syntaxhighlighter table tr,.syntaxhighlighter textarea{position:static;top:auto;right:auto;bottom:auto;left:auto;float:none;overflow:visible;box-sizing:content-box;margin:0;padding:0;width:auto;height:auto;min-height:inherit;min-height:auto;outline:0;border:0;-webkit-border-radius:0;-moz-border-radius:0;background:0 0;vertical-align:baseline;text-align:left;font-weight:400;font-style:normal;font-size:1em;font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;line-height:1.1em}.syntaxhighlighter{position:relative;overflow:auto;margin:1em 0 1em 0;width:100%;font-size:1em}.syntaxhighlighter.source{overflow:hidden}.syntaxhighlighter .bold{font-weight:700}.syntaxhighlighter .italic{font-style:italic}.syntaxhighlighter .line{white-space:pre}.syntaxhighlighter table{width:100%}.syntaxhighlighter table caption{padding:.5em 0 .5em 1em;text-align:left}.syntaxhighlighter table td.code{width:100%}.syntaxhighlighter table td.code .container{position:relative}.syntaxhighlighter table td.code .container textarea{position:absolute;top:0;left:0;overflow:hidden;box-sizing:border-box;padding-left:1em;width:100%;height:100%;border:none;background:#fff;white-space:pre}.syntaxhighlighter table td.gutter .line{padding:0 .5em 0 1em;text-align:right}.syntaxhighlighter table td.code .line{padding:0 1em}.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0}.syntaxhighlighter.show{display:block}.syntaxhighlighter.collapsed table{display:none}.syntaxhighlighter.collapsed .toolbar{position:static;padding:.1em .8em 0 .8em;width:auto;height:auto;font-size:1em}.syntaxhighlighter.collapsed .toolbar span{display:inline;margin-right:1em}.syntaxhighlighter.collapsed .toolbar span a{display:none;padding:0}.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline}.syntaxhighlighter .toolbar{position:absolute;top:1px;right:1px;z-index:10;width:11px;height:11px;font-size:10px}.syntaxhighlighter .toolbar span.title{display:inline}.syntaxhighlighter .toolbar a{display:block;padding-top:1px;text-align:center;text-decoration:none}.syntaxhighlighter .toolbar a.expandSource{display:none}.syntaxhighlighter.ie{padding:1px 0 1px 0;font-size:.9em}.syntaxhighlighter.ie .toolbar{line-height:8px}.syntaxhighlighter.ie .toolbar a{padding-top:0}.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:0 0}.syntaxhighlighter.printing .line .number{color:#bbb}.syntaxhighlighter.printing .line .content{color:#000}.syntaxhighlighter.printing .toolbar{display:none}.syntaxhighlighter.printing a{text-decoration:none}.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:#000}.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200}.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:#00f}.syntaxhighlighter.printing .keyword{color:#069;font-weight:700}.syntaxhighlighter.printing .preprocessor{color:gray}.syntaxhighlighter.printing .variable{color:#a70}.syntaxhighlighter.printing .value{color:#090}.syntaxhighlighter.printing .functions{color:#ff1493}.syntaxhighlighter.printing .constants{color:#06c}.syntaxhighlighter.printing .script{font-weight:700}.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray}.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493}.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red}.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:#000}.syntaxhighlighter{background-color:#fff}.syntaxhighlighter .line.alt1{background-color:#fff}.syntaxhighlighter .line.alt2{background-color:#fff}.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0}.syntaxhighlighter .line.highlighted.number{color:#000}.syntaxhighlighter table caption{color:#000}.syntaxhighlighter .gutter{color:#afafaf}.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c}.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c;color:#fff}.syntaxhighlighter.printing .line .content{border:none}.syntaxhighlighter.collapsed{overflow:visible}.syntaxhighlighter.collapsed .toolbar{border:1px solid #6ce26c;background:#fff;color:#00f}.syntaxhighlighter.collapsed .toolbar a{color:#00f}.syntaxhighlighter.collapsed .toolbar a:hover{color:red}.syntaxhighlighter .toolbar{border:none;background:#6ce26c;color:#fff}.syntaxhighlighter .toolbar a{color:#fff}.syntaxhighlighter .toolbar a:hover{color:#000}.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#000}.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200}.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#00f}.syntaxhighlighter .keyword{color:#069}.syntaxhighlighter .preprocessor{color:gray}.syntaxhighlighter .variable{color:#a70}.syntaxhighlighter .value{color:#090}.syntaxhighlighter .functions{color:#ff1493}.syntaxhighlighter .constants{color:#06c}.syntaxhighlighter .script{background-color:none;color:#069;font-weight:700}.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray}.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493}.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red}.syntaxhighlighter .keyword{font-weight:700}.syntaxhighlighter table{margin:1px 0}
</style>
<h2><span style="color: #008000;"><strong>源代码带注释：</strong></span></h2>
<div id="highlighter_258103" class="syntaxhighlighter nogutter  php">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="php comments">// 站外链接nofollow，target</code></div>
<div class="line number2 index1 alt1"><code class="php plain">add_filter( </code><code class="php string">'the_content'</code><code class="php plain">, </code><code class="php string">'nofollow_a_links'</code><code class="php plain">);</code></div>
<div class="line number3 index2 alt2"><code class="php keyword">function</code> <code class="php plain">nofollow_a_links (</code><code class="php variable">$content</code><code class="php plain">) {</code></div>
<div class="line number4 index3 alt1"><code class="php spaces">    </code><code class="php variable">$regexp</code> <code class="php plain">= </code><code class="php string">"&lt;a\s[^&gt;]*href=(\"??)([^\" &gt;]*?)\\1[^&gt;]*&gt;"</code><code class="php plain">;</code></div>
<div class="line number5 index4 alt2"><code class="php spaces">    </code><code class="php keyword">if</code> <code class="php plain">(preg_match_all(</code><code class="php string">"/$regexp/siU"</code><code class="php plain">, </code><code class="php variable">$content</code><code class="php plain">, </code><code class="php variable">$matches</code><code class="php plain">, PREG_SET_ORDER)) {</code></div>
<div class="line number6 index5 alt1"><code class="php spaces">        </code><code class="php variable">$srcUrl</code> <code class="php plain">= </code><code class="php variable">$_SERVER</code><code class="php plain">[</code><code class="php string">'SERVER_NAME'</code><code class="php plain">];</code></div>
<div class="line number7 index6 alt2"><code class="php spaces">        </code><code class="php variable">$now_pos</code> <code class="php plain">=0;</code></div>
<div class="line number8 index7 alt1"><code class="php spaces">        </code><code class="php keyword">for</code> <code class="php plain">(</code><code class="php variable">$i</code> <code class="php plain">= 0; </code><code class="php variable">$i</code> <code class="php plain">&lt; </code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$matches</code><code class="php plain">); </code><code class="php variable">$i</code><code class="php plain">++) {</code></div>
<div class="line number9 index8 alt2"><code class="php spaces">            </code><code class="php comments">//不包含本站域名，同时不是href="/dm/p/5" 这种形式</code></div>
<div class="line number10 index9 alt1"><code class="php spaces">            </code><code class="php keyword">if</code> <code class="php plain">( </code><code class="php functions">strpos</code><code class="php plain">(</code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0], </code><code class="php variable">$srcUrl</code><code class="php plain">) === false &amp;&amp; </code><code class="php functions">strpos</code><code class="php plain">(</code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0], </code><code class="php string">'//'</code><code class="php plain">) !== false ) {</code></div>
<div class="line number11 index10 alt2"><code class="php spaces">                </code><code class="php variable">$tag</code> <code class="php plain">= </code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0];</code></div>
<div class="line number12 index11 alt1"><code class="php spaces">                </code><code class="php variable">$tag0</code> <code class="php plain">= </code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0];</code></div>
<div class="line number13 index12 alt2"><code class="php spaces">                </code><code class="php variable">$noFollow</code> <code class="php plain">= </code><code class="php string">''</code><code class="php plain">;</code></div>
<div class="line number14 index13 alt1"><code class="php spaces">                </code><code class="php comments">//添加 _blank</code></div>
<div class="line number15 index14 alt2"><code class="php spaces">                </code><code class="php variable">$pattern</code> <code class="php plain">= </code><code class="php string">'/target\s*=\s*"\s*_blank\s*"/'</code><code class="php plain">;</code></div>
<div class="line number16 index15 alt1"><code class="php spaces">                </code><code class="php plain">preg_match(</code><code class="php variable">$pattern</code><code class="php plain">, </code><code class="php variable">$tag2</code><code class="php plain">, </code><code class="php variable">$match</code><code class="php plain">);</code></div>
<div class="line number17 index16 alt2"><code class="php spaces">                </code><code class="php keyword">if</code> <code class="php plain">(</code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$match</code><code class="php plain">) &lt; 1) </code><code class="php variable">$noFollow</code><code class="php plain">.= </code><code class="php string">' target="_blank" '</code><code class="php plain">;</code></div>
<div class="line number18 index17 alt1"><code class="php spaces">                </code><code class="php comments">//添加nofollow</code></div>
<div class="line number19 index18 alt2"><code class="php spaces">                </code><code class="php variable">$pattern</code> <code class="php plain">= </code><code class="php string">'/rel\s*=\s*"\s*[n|d]ofollow\s*"/'</code><code class="php plain">;</code></div>
<div class="line number20 index19 alt1"><code class="php spaces">                </code><code class="php plain">preg_match(</code><code class="php variable">$pattern</code><code class="php plain">, </code><code class="php variable">$tag2</code><code class="php plain">, </code><code class="php variable">$match</code><code class="php plain">);</code></div>
<div class="line number21 index20 alt2"><code class="php spaces">                </code><code class="php keyword">if</code> <code class="php plain">(</code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$match</code><code class="php plain">) &lt; 1) </code><code class="php variable">$noFollow</code><code class="php plain">.= </code><code class="php string">' rel="nofollow" '</code><code class="php plain">;</code></div>
<div class="line number22 index21 alt1"><code class="php spaces">                </code><code class="php comments">//写入</code></div>
<div class="line number23 index22 alt2"><code class="php spaces">                </code><code class="php keyword">if</code><code class="php plain">(</code><code class="php variable">$noFollow</code> <code class="php plain">!= </code><code class="php string">''</code><code class="php plain">){</code></div>
<div class="line number24 index23 alt1"><code class="php spaces">                    </code><code class="php comments">//只进行单次替换，且使用$now_pos 记录$content的处理进度</code></div>
<div class="line number25 index24 alt2"><code class="php spaces">                    </code><code class="php variable">$now_pos</code> <code class="php plain">= </code><code class="php functions">strpos</code><code class="php plain">(</code><code class="php variable">$content</code><code class="php plain">, </code><code class="php variable">$tag0</code><code class="php plain">, </code><code class="php variable">$now_pos</code><code class="php plain">);</code></div>
<div class="line number26 index25 alt1"><code class="php spaces">                    </code><code class="php variable">$tag</code> <code class="php plain">= rtrim(</code><code class="php variable">$tag</code><code class="php plain">, </code><code class="php string">'&gt;'</code><code class="php plain">); </code><code class="php variable">$tag</code><code class="php plain">.= </code><code class="php variable">$noFollow</code> <code class="php plain">. </code><code class="php string">'&gt;'</code><code class="php plain">;</code></div>
<div class="line number27 index26 alt2"><code class="php spaces">                    </code><code class="php variable">$content</code> <code class="php plain">= substr_replace( </code><code class="php variable">$content</code><code class="php plain">, </code><code class="php variable">$tag</code><code class="php plain">, </code><code class="php variable">$now_pos</code><code class="php plain">, </code><code class="php functions">strlen</code><code class="php plain">(</code><code class="php variable">$tag0</code><code class="php plain">) );</code></div>
<div class="line number28 index27 alt1"><code class="php spaces">                </code><code class="php plain">}</code></div>
<div class="line number29 index28 alt2"><code class="php spaces">            </code><code class="php plain">}</code></div>
<div class="line number30 index29 alt1"><code class="php spaces">        </code><code class="php plain">}</code></div>
<div class="line number31 index30 alt2"><code class="php spaces">    </code><code class="php plain">}</code></div>
<div class="line number32 index31 alt1"><code class="php spaces">    </code><code class="php keyword">return</code> <code class="php variable">$content</code><code class="php plain">;</code></div>
<div class="line number33 index32 alt2"><code class="php plain">}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
<hr />
<h2><span style="color: #333399;">经历</span></h2>
<p>以前用的都是下面这段代码，网上随便找的，但是啥也没想，直接粘贴后就开始用了，效果也还行，就没有多研究这段代码了：</p>
<div id="highlighter_328832" class="syntaxhighlighter nogutter  php">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="php plain">add_filter( </code><code class="php string">'the_content'</code><code class="php plain">, </code><code class="php string">'cn_nf_url_parse'</code><code class="php plain">);</code></div>
<div class="line number2 index1 alt1"><code class="php keyword">function</code> <code class="php plain">cn_nf_url_parse( </code><code class="php variable">$content</code> <code class="php plain">) {</code></div>
<div class="line number3 index2 alt2"><code class="php spaces">    </code><code class="php variable">$regexp</code> <code class="php plain">= </code><code class="php string">"&lt;a\s[^&gt;]*href=(\"??)([^\" &gt;]*?)\\1[^&gt;]*&gt;"</code><code class="php plain">;</code></div>
<div class="line number4 index3 alt1"><code class="php spaces">    </code><code class="php keyword">if</code><code class="php plain">(preg_match_all(</code><code class="php string">"/$regexp/siU"</code><code class="php plain">, </code><code class="php variable">$content</code><code class="php plain">, </code><code class="php variable">$matches</code><code class="php plain">, PREG_SET_ORDER)) {</code></div>
<div class="line number5 index4 alt2"><code class="php spaces">        </code><code class="php keyword">if</code><code class="php plain">( !</code><code class="php functions">empty</code><code class="php plain">(</code><code class="php variable">$matches</code><code class="php plain">) ) {</code></div>
<div class="line number6 index5 alt1"><code class="php spaces">            </code><code class="php variable">$srcUrl</code> <code class="php plain">= get_option(</code><code class="php string">'siteurl'</code><code class="php plain">);</code></div>
<div class="line number7 index6 alt2"><code class="php spaces">            </code><code class="php keyword">for</code> <code class="php plain">(</code><code class="php variable">$i</code><code class="php plain">=0; </code><code class="php variable">$i</code> <code class="php plain">&lt; </code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$matches</code><code class="php plain">); </code><code class="php variable">$i</code><code class="php plain">++)</code></div>
<div class="line number8 index7 alt1"><code class="php spaces">            </code><code class="php plain">{</code></div>
<div class="line number9 index8 alt2"><code class="php spaces">                </code><code class="php variable">$tag</code> <code class="php plain">= </code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0];</code></div>
<div class="line number10 index9 alt1"><code class="php spaces">                </code><code class="php variable">$tag2</code> <code class="php plain">= </code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0];</code></div>
<div class="line number11 index10 alt2"><code class="php spaces">                </code><code class="php variable">$url</code> <code class="php plain">= </code><code class="php variable">$matches</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">][0];</code></div>
<div class="line number12 index11 alt1"><code class="php spaces">                </code><code class="php variable">$noFollow</code> <code class="php plain">= </code><code class="php string">''</code><code class="php plain">;</code></div>
<div class="line number13 index12 alt2"><code class="php spaces">                </code><code class="php variable">$pattern</code> <code class="php plain">= </code><code class="php string">'/target\s*=\s*"\s*_blank\s*"/'</code><code class="php plain">;</code></div>
<div class="line number14 index13 alt1"><code class="php spaces">                </code><code class="php plain">preg_match(</code><code class="php variable">$pattern</code><code class="php plain">, </code><code class="php variable">$tag2</code><code class="php plain">, </code><code class="php variable">$match</code><code class="php plain">, PREG_OFFSET_CAPTURE);</code></div>
<div class="line number15 index14 alt2"><code class="php spaces">                </code><code class="php keyword">if</code><code class="php plain">( </code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$match</code><code class="php plain">) &lt; 1 )</code></div>
<div class="line number16 index15 alt1"><code class="php spaces">                    </code><code class="php variable">$noFollow</code> <code class="php plain">.= </code><code class="php string">' target="_blank" '</code><code class="php plain">;</code></div>
<div class="line number17 index16 alt2"><code class="php spaces">                </code><code class="php variable">$pattern</code> <code class="php plain">= </code><code class="php string">'/rel\s*=\s*"\s*[n|d]ofollow\s*"/'</code><code class="php plain">;</code></div>
<div class="line number18 index17 alt1"><code class="php spaces">                </code><code class="php plain">preg_match(</code><code class="php variable">$pattern</code><code class="php plain">, </code><code class="php variable">$tag2</code><code class="php plain">, </code><code class="php variable">$match</code><code class="php plain">, PREG_OFFSET_CAPTURE);</code></div>
<div class="line number19 index18 alt2"><code class="php spaces">                </code><code class="php keyword">if</code><code class="php plain">( </code><code class="php functions">count</code><code class="php plain">(</code><code class="php variable">$match</code><code class="php plain">) &lt; 1 )</code></div>
<div class="line number20 index19 alt1"><code class="php spaces">                    </code><code class="php variable">$noFollow</code> <code class="php plain">.= </code><code class="php string">' rel="nofollow" '</code><code class="php plain">;</code></div>
<div class="line number21 index20 alt2"><code class="php spaces">                </code><code class="php variable">$pos</code> <code class="php plain">= </code><code class="php functions">strpos</code><code class="php plain">(</code><code class="php variable">$url</code><code class="php plain">,</code><code class="php variable">$srcUrl</code><code class="php plain">);</code></div>
<div class="line number22 index21 alt1"><code class="php spaces">                </code><code class="php keyword">if</code> <code class="php plain">(</code><code class="php variable">$pos</code> <code class="php plain">=== false) {</code></div>
<div class="line number23 index22 alt2"><code class="php spaces">                    </code><code class="php variable">$tag</code> <code class="php plain">= rtrim (</code><code class="php variable">$tag</code><code class="php plain">,</code><code class="php string">'&gt;'</code><code class="php plain">);</code></div>
<div class="line number24 index23 alt1"><code class="php spaces">                    </code><code class="php variable">$tag</code> <code class="php plain">.= </code><code class="php variable">$noFollow</code><code class="php plain">.</code><code class="php string">'&gt;'</code><code class="php plain">;</code></div>
<div class="line number25 index24 alt2"><code class="php spaces">                    </code><code class="php variable">$content</code> <code class="php plain">= </code><code class="php functions">str_replace</code><code class="php plain">(</code><code class="php variable">$tag2</code><code class="php plain">,</code><code class="php variable">$tag</code><code class="php plain">,</code><code class="php variable">$content</code><code class="php plain">);</code></div>
<div class="line number26 index25 alt1"><code class="php spaces">                </code><code class="php plain">}</code></div>
<div class="line number27 index26 alt2"><code class="php spaces">            </code><code class="php plain">}</code></div>
<div class="line number28 index27 alt1"><code class="php spaces">        </code><code class="php plain">}</code></div>
<div class="line number29 index28 alt2"><code class="php spaces">    </code><code class="php plain">}</code></div>
<div class="line number30 index29 alt1"><code class="php spaces">    </code><code class="php variable">$content</code> <code class="php plain">= </code><code class="php functions">str_replace</code><code class="php plain">(</code><code class="php string">']]&gt;'</code><code class="php plain">, </code><code class="php string">']]&gt;'</code><code class="php plain">, </code><code class="php variable">$content</code><code class="php plain">);</code></div>
<div class="line number31 index30 alt2"><code class="php spaces">    </code><code class="php keyword">return</code> <code class="php variable">$content</code><code class="php plain">;</code></div>
<div class="line number32 index31 alt1"><code class="php plain">}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
<p>自动查找指向站外的链接，如果该链接指向站外，并且没有 <em>nofollow</em> 或 <em>_blank</em>，则会自动添加，功能上到还是都实现了，没啥问题。</p>
<p>然后是近日发现，对于 <span style="color: #000080;">&lt;a href=&#8221;/i/zytbz&#8221;&gt;</span> 这种链接，这段代码也会识别成站外链接。于是，我就准备把这段代码改改。</p>
<p><span style="color: #99cc00;"><strong>不看不要紧，一看才发现这段代码简直是坑爹啊！是发布专门用来拖慢我们的服务器的吗？</strong></span></p>
<p>特别是最后这句，安的究竟是什么心：</p>
<div id="highlighter_231391" class="syntaxhighlighter nogutter  php">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="php variable">$content</code> <code class="php plain">= </code><code class="php functions">str_replace</code><code class="php plain">(</code><code class="php string">']]&gt;'</code><code class="php plain">, </code><code class="php string">']]&gt;'</code><code class="php plain">, </code><code class="php variable">$content</code><code class="php plain">);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>除此之外，这段代码的逻辑似乎就有一点问题：</strong></p>
<p>1、对每个链接对象，先进行一个镜像，镜像中添加 nofollow 属性。</p>
<p>2、在判断这个链接是否指向站外，如果是，将 $content 当中的源链接用 str_replace 替换成修改后的链接。</p>
<p>这么想这两步都反了，应该先判断是否是站外链接，再添加属性才对。</p>
<p><strong>其次，每一次 str_replace，都会将 $content 全部扫描一遍（从头到尾），然而最后只替换掉当中的一条，这太浪费时间了！</strong><span style="color: #999999;">(时间复杂度为 N+1)</span></p>
<p>最佳算法当然是对于 $content，查找到一条 A 链接，判断处理一条，时间复杂度为 1。</p>
<p>但我查阅了很多资料，PHP 中的所有查找函数都只能返回查找后的结果，而不能返回找到目标的位置，总之是没法实现了，后来换了实现方法，让复杂度降为 2，大家可以去看代码，不细说了。</p>
<p>只想说 PHP 还是不够灵活啊。</p>
<blockquote>
<h2><span style="color: #800080;">我的代码的优势</span></h2>
<p>大大优化运行效率。</p>
<p>可以识别 <span style="text-decoration: underline;">&lt;a href=&#8221;/dm/top10&#8243;&gt;</span> &amp; <span style="text-decoration: underline;">&lt;a href=&#8221;//baidu.com&#8221;&gt;</span>，这样的链接。</p></blockquote>
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/1640/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1640</post-id>	</item>
		<item>
		<title>WordPress免插件实现音乐播放</title>
		<link>https://hzy.pw/p/442</link>
					<comments>https://hzy.pw/p/442#respond</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Sun, 12 Jan 2014 14:25:15 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://www.hzyisme.com/?p=442</guid>

					<description><![CDATA[算是折腾了一晚上，终于给网站加上了音乐播放功能，先秀一个效果： &#160; 我一开始是尝试了很多的插件，Fl <a class="read-more" href="https://hzy.pw/p/442">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>算是折腾了一晚上，终于给网站加上了音乐播放功能，先秀一个效果：</p>
<p><a href="https://hzy.pw/wp-content/uploads/2014/01/TM20140112214814.jpg"><img loading="lazy" decoding="async" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="TM截图20140112214814" src="https://hzy.pw/wp-content/uploads/2014/01/TM20140112214814_thumb.jpg" alt="TM截图20140112214814" width="369" height="167" border="0" /></a></p>
<p><span id="more-442"></span></p>
<p>&nbsp;</p>
<p>我一开始是尝试了很多的插件，Flash的就不考虑了。有几个插件用的HTML5+jquery，样式好看，功能强大。可以显示播放列表、专辑图片、歌曲信息等。</p>
<p>不过用起来都却很不顺手，一个是外国人开发的，显示的歌曲信息都不支持中文-，-。另一个是一个中国高三技术宅写的，不知道为什么运行后会加载各种js库，包括cnzz之类的就有好几个。。。</p>
<p>于是我就自己写了音乐播放器，简单爆了，非常好用！其实也是，何必什么都去找插件。</p>
<p>&nbsp;</p>
<p><strong><span style="color: #8064a2;">我是用的是HTML5中自带的音乐播放器，只需一句html即可搞定！同时，音乐播放器还支持ios安卓等浏览器。</span></strong></p>
<p><span style="color: #000000;">在你需要加入播放器的任何地方（比如侧边栏、文章等），加入下面一句：</span></p>
<div class="csharpcode">
<pre class="alt"><span class="kwrd">&lt;</span><span class="html">audio</span> <span class="attr">src</span><span class="kwrd">="https://hzy.pw/song.ogg"</span><span class="kwrd">&gt;&lt;/</span><span class="html">audio</span><span class="kwrd">&gt;</span></pre>
</div>
<p><span style="color: #000000;">其中，src属性为歌曲的链接，歌曲支持mp3、ogg、wav格式</span></p>
<p><span style="color: #000000;">效果预览：</span><audio src="http://sc.111ttt.com/up/mp3/201474/60D607FDDEFFDD934918322C39FB608E.mp3"></audio></p>
<p>&nbsp;</p>
<p>可以添加control属性，使播放器显示 <em>播放暂停、进度条、音量</em> 这几个设置。如果在&lt;audio&gt;间加入文字，就可以在不支持HTML5的浏览器中显示这些文字。</p>
<div id="highlighter_6801" class="syntaxhighlighter nogutter  xml">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">audio</code> <code class="xml color1">controls</code><code class="xml plain">=</code><code class="xml string">"controls"</code> <code class="xml color1">preload</code><code class="xml plain">=</code><code class="xml string">"none"</code> <code class="xml color1">loop</code><code class="xml plain">=</code><code class="xml string">"loop"</code> <code class="xml color1">autoplay</code><code class="xml plain">=</code><code class="xml string">"autoplay"</code> <code class="xml color1">src</code><code class="xml plain">=</code><code class="xml string">"<a href="http://www.gqqa.com/www.gqqa.com/5/ulWpCNzORuruO.mp3">http://www.gqqa.com/www.gqqa.com/5/ulWpCNzORuruO.mp3</a>"</code> <code class="xml plain">&gt;</code></div>
<div class="line number2 index1 alt1"><code class="xml spaces">  </code><code class="xml plain">&lt;</code><code class="xml keyword">b</code><code class="xml plain">&gt;播放器不兼容你的浏览器&lt;/</code><code class="xml keyword">b</code><code class="xml plain">&gt;</code></div>
<div class="line number3 index2 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">audio</code><code class="xml plain">&gt;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>效果预览：</p>
<p>&nbsp;</p>
<p>【自动播放】加入属性 autoplay 即可实现自动开始播放，不用手动点击开始。</p>
<p>【循环播放】加入属性Loop即可。</p>
<p>【自动加载】加入属性 preload=”none”。<strong><span style="color: #646b86; background-color: #dfce04;">如果不加这句，html5默认定义是加载页面时就会缓冲音乐，而不是开始播放后，才开始缓冲！<br />
</span></strong></p>
<p>==================================</p>
<p>就是这样~！over</p>
<p>如果还有疑问请向我留言。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/442/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="http://hzy.pw/song.ogg" length="5367" type="audio/ogg" />
<enclosure url="http://sc.111ttt.com/up/mp3/201474/60D607FDDEFFDD934918322C39FB608E.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://www.gqqa.com/www.gqqa.com/5/ulWpCNzORuruO.mp3" length="0" type="audio/mpeg" />

		<post-id xmlns="com-wordpress:feed-additions:1">442</post-id>	</item>
		<item>
		<title>wordprrss被人恶意刷流量的解决方案</title>
		<link>https://hzy.pw/p/142</link>
					<comments>https://hzy.pw/p/142#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Sat, 07 Sep 2013 10:36:00 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>
		<guid isPermaLink="false">http://hzyisme.com/?p=142</guid>

					<description><![CDATA[网站被人恶意刷流量，我就是当中的受害者。服务器10gb一个月的流量一天就被一个ip用掉2gb。 被刷流量除了让 <a class="read-more" href="https://hzy.pw/p/142">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>网站被人恶意刷流量，我就是当中的受害者。服务器10gb一个月的流量一天就被一个ip用掉2gb。<br />
被刷流量除了让你多花钱在宽带上，还会大大降低网页的访问速度，如果添设了广告，还有被广告联盟认为非法刷广告的嫌疑。所以，遇到这种行为必须得认真对待，痛下杀手！<br />
<span id="more-142"></span><br />
<strong>1、找清楚被恶意刷流量的原因</strong></p>
<p>&nbsp;</p>
<p>最有可能的是来源于竞争对手的攻击，强烈鄙视这种</p>
<p>如果没有竞争对手，比如我，当时博客开通才2天，文章只有个位数<br />
那么就是遇到了闲的蛋疼的人了。。。这种人没事干，就开着工具刷别人网站，以此取乐。<br />
对这种人已经不需要鄙视了，因为太sb，应该同情！</p>
<p>&nbsp;</p>
<p><strong>2、找到刷流量的IP</strong></p>
<p>这个可以在服务器后台看到，那个ip消耗的流量最多</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/08/20130830121042744.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-88" alt="TM截图20130830121106" src="https://hzy.pw/wp-content/uploads/2013/08/20130830121042744.jpg" width="553" height="67" srcset="https://hzy.pw/wp-content/uploads/2013/08/20130830121042744.jpg 553w, https://hzy.pw/wp-content/uploads/2013/08/20130830121042744-300x36.jpg 300w" sizes="auto, (max-width: 553px) 100vw, 553px" /></a></p>
<p>比如刷我流量的就是这个：110.228.226.126。<br />
可以去<a href="http://ip138.com">ip138.com</a>查询ip归属地</p>
<p>&nbsp;</p>
<p>【！】如果发现刷流量的坏人有很多IP，那往往是有人雇佣了专业的刷流量公司对付你</p>
<p>&nbsp;</p>
<p><strong>3、果断封IP</strong></p>
<p>封IP可以在服务器后台，也可以通过wordpress的插件搞定</p>
<p>服务器的功能往往都没有插件强大，主要表现在下面几个方面：</p>
<p>&nbsp;</p>
<p>A、不可以封IP段，比如111.222.x.x这样</p>
<p>B、不可以这样自由设置封IP后的显示界面<br />
比如黑名单的ip访问我的主页，载入完毕后只可以看到一句话 “此页面不对你开放”</p>
<p>&nbsp;</p>
<p><strong>wp插件： wp-ban</strong></p>
<p>&nbsp;</p>
<p>下载链接：<a href="http://wordpress.org/plugins/wp-ban/">http://wordpress.org/plugins/wp-ban/</a></p>
<p>&nbsp;</p>
<p>安装完成后，在wp左侧设置当中，就可以看到新的“ban”菜单</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/09/20130907184452147.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-146" alt="84313" src="https://hzy.pw/wp-content/uploads/2013/09/20130907184452147.jpg" width="303" height="227" srcset="https://hzy.pw/wp-content/uploads/2013/09/20130907184452147.jpg 303w, https://hzy.pw/wp-content/uploads/2013/09/20130907184452147-300x224.jpg 300w" sizes="auto, (max-width: 303px) 100vw, 303px" /></a></p>
<p>&nbsp;</p>
<p>然后进入，之后在<strong>Banned IPs</strong>当中输入需要的封掉的IP地址，可以用*符号通配</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/09/20130907185139383.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-147" alt="TM鎴浘20130907185109" src="https://hzy.pw/wp-content/uploads/2013/09/20130907185139383.jpg" width="751" height="233" srcset="https://hzy.pw/wp-content/uploads/2013/09/20130907185139383.jpg 751w, https://hzy.pw/wp-content/uploads/2013/09/20130907185139383-300x93.jpg 300w" sizes="auto, (max-width: 751px) 100vw, 751px" /></a></p>
<p>&nbsp;</p>
<p><strong>【我的独家超级教程来了】</strong></p>
<p>&nbsp;</p>
<p>这里给大家讲一个非常厉害的方法，可以斩草除根，解决后患！</p>
<p>&nbsp;</p>
<p>在WP-Ban中的<strong>Banned</strong> <strong>Message</strong>可以设置对用户显示的内容，默认是：</p>
<p style="text-align: center;">&lt;p style=&#8221;text-align: center; font-weight: bold;&#8221;&gt;You Are Banned.&lt;/p&gt;</p>
<p>也就是显示出一行字：You Are Banned.</p>
<p>&nbsp;</p>
<p>是不是感觉完全没有什么意义，我在这里把他修改为：</p>
<p style="text-align: center;">&lt;SCRIPT LANGUAGE=&#8221;javascript&#8221;&gt;<br />
alert(&#8220;网站加载错误&#8221;);<br />
&lt;/SCRIPT&gt;</p>
<p style="text-align: left;">作用是自动弹出一个对话框——“网站加载错误”</p>
<p style="text-align: left;">这么做的原因是因为如果对方雇佣了了刷流量的工作室，工作室一般都不会受理这种会自动弹出对话框的网站的工作</p>
<p style="text-align: left;">二是显示出加载错误，会让对方误以为网站已经关闭了，于是离开 -。-</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/142/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">142</post-id>	</item>
		<item>
		<title>测试使用Windows Live Writer写博客</title>
		<link>https://hzy.pw/p/69</link>
					<comments>https://hzy.pw/p/69#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Thu, 29 Aug 2013 06:21:50 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[闲谈随手记]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://hzyisme.com/?p=69</guid>

					<description><![CDATA[这样我就可以摆脱在网络上的麻烦编辑器，直接使用客户端来写博客了！ 编辑起来就像是Word一样，毕竟是微软家的， <a class="read-more" href="https://hzy.pw/p/69">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>这样我就可以摆脱在网络上的麻烦编辑器，直接使用客户端来写博客了！</p>
<p><strong><span style="font-family: 楷体; font-size: large;">编辑起来就像是Word一样，毕竟是微软家的，很顺手！</span></strong></p>
<p><strong></strong> <br />
<span id="more-69"></span></p>
<p><span style="font-family: Arial; font-size: medium;">主要是测试一下图片是否可以正常上传：</span></p>
<p><strong><span style="font-family: 楷体; font-size: large;"><a href="https://hzy.pw/wp-content/uploads/2013/08/e91fa13e828c.jpg"><img loading="lazy" decoding="async" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="无标题" alt="无标题" src="https://hzy.pw/wp-content/uploads/2013/08/thumb.jpg" width="244" height="201" border="0" /></a></span></strong></p>
<p>&nbsp;</p>
<p>在使用Live Writer之前，我还尝试过一款国人开发的软件：菊子曰</p>
<p>不仅可以离线写博，还可以一键发布到多个博客，包括QQ空间、XX博客，等等叫得上名字的博客服务器。还可以聚合发送微博</p>
<p>而Live Writer在国内只支持新浪、网易等为数不多的几个站点</p>
<p>菊子曰是个好软件，但是后来竟然发现12年12月，这款软件已经宣布停止更新了，真让人可惜，作为一款免费软件，可能在中国这个盗版=正版的国家，实在是没什么利润吧</p>
<p>&nbsp;</p>
<p>这篇文章主要是用来测试WLW发送博客是否成功。</p>
<p>另外，希望菊子曰这种好的免费软件可以更好的发展</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/69/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">69</post-id>	</item>
		<item>
		<title>解决WordPress上传中文图片无法显示的问题</title>
		<link>https://hzy.pw/p/57</link>
					<comments>https://hzy.pw/p/57#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Thu, 29 Aug 2013 02:02:03 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>
		<guid isPermaLink="false">http://hzyisme.com/?p=57</guid>

					<description><![CDATA[站点搭建好了，写了两篇文章，不过确是相当的不顺手，原因就在于上传图片必须为英文，如果是中文则不能显示 百度N下 <a class="read-more" href="https://hzy.pw/p/57">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p>站点搭建好了，写了两篇文章，不过确是相当的不顺手，原因就在于上传图片必须为英文，如果是中文则不能显示</p>
<p>百度N下，得到的方法都是过时了的，经过自己的研究解决好啦，方法如下</p>
<p><span id="more-57"></span></p>
<p>1、下载你的《wp-admin/includes/file.php》文件到本地</p>
<p>&nbsp;</p>
<p>2、打开，找到330行：</p>
<p>$new_file = $uploads[&#8216;path&#8217;] . &#8220;/$filename&#8221;;</p>
<p>如果不能找到，则全文搜索：</p>
<p>Move the file to the uploads dir</p>
<p>&nbsp;</p>
<p>3、修改$new_file = $uploads[&#8216;path&#8217;] . &#8220;/$filename&#8221;;</p>
<p>为：$new_file = $uploads[&#8216;path&#8217;] . &#8220;/&#8221;.date_i18n(&#8220;YmdHis&#8221;).floor(microtime()*1000).&#8221;.&#8221;.$ext;</p>
<p>&nbsp;</p>
<p>4、保存、上传、覆盖，现在试着上传一个图片，就会自动保存为“年月日时分秒+千位毫秒整数”的新文件名，并保存到相应的年月文件夹之下</p>
<p>完美解决中文图片不能正常显示的问题！</p>
<p style="text-align: center;"><a href="https://hzy.pw/wp-content/uploads/2013/08/20130829100146844.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-58" alt="TM截图20130829095332" src="https://hzy.pw/wp-content/uploads/2013/08/20130829100146844.jpg" width="290" height="164" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/57/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">57</post-id>	</item>
		<item>
		<title>在WordPress中加入赞按钮、一键分享（该内容对我有帮助）</title>
		<link>https://hzy.pw/p/48</link>
					<comments>https://hzy.pw/p/48#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Thu, 29 Aug 2013 01:26:24 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>
		<guid isPermaLink="false">http://hzyisme.com/?p=48</guid>

					<description><![CDATA[通过我的这个方法，每一篇文章的末尾都会自动显示出赞或是分享按钮，非常的方便！ （上面是个图片，不能点的~）。  <a class="read-more" href="https://hzy.pw/p/48">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://hzy.pw/wp-content/uploads/2013/08/29091440.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-49" alt="29091440" src="https://hzy.pw/wp-content/uploads/2013/08/29091440.jpg" width="152" height="70" srcset="https://hzy.pw/wp-content/uploads/2013/08/29091440.jpg 152w, https://hzy.pw/wp-content/uploads/2013/08/29091440-150x70.jpg 150w" sizes="auto, (max-width: 152px) 100vw, 152px" /></a>通过我的这个方法，每一篇文章的末尾都会自动显示出赞或是分享按钮，非常的方便！</p>
<p>（上面是个图片，不能点的~）。</p>
<p><span id="more-48"></span></p>
<p>【说明】</p>
<p>使用这个方法只能添加按钮，在每一篇文章的末尾（赞、分享都可以）。但是如果想要添加的是悬浮窗，悬浮窗只会在文章界面出现</p>
<p>如果想要让他也在主页出现，请参考这篇文章：<a href="https://hzy.pw/?p=30">https://hzy.pw/?p=30</a></p>
<p>&nbsp;</p>
<p>1、获取JS代码，百度分享，或是加网等都可以</p>
<p>不过传说百度分享可以增加你的网站被百度收录的几率，链接：<a href="http://share.baidu.com/code">http://share.baidu.com/code</a></p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/08/9092133.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-50" alt="9092133" src="https://hzy.pw/wp-content/uploads/2013/08/9092133.jpg" width="384" height="218" srcset="https://hzy.pw/wp-content/uploads/2013/08/9092133.jpg 384w, https://hzy.pw/wp-content/uploads/2013/08/9092133-300x170.jpg 300w" sizes="auto, (max-width: 384px) 100vw, 384px" /></a>直接获取你想要的JS代码，然后保存下来</p>
<p>&nbsp;</p>
<p>2、打开你的主页，进入后台 -&gt; 外观 -&gt; 编辑</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/08/231839.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-40" alt="231839" src="https://hzy.pw/wp-content/uploads/2013/08/231839.jpg" width="163" height="185" /></a></p>
<p>&nbsp;</p>
<p>3、在右侧的文件列表选择最下面的single.php（文章界面）</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/08/2424.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-51" alt="2424" src="https://hzy.pw/wp-content/uploads/2013/08/2424.jpg" width="210" height="285" /></a></p>
<p>&nbsp;</p>
<p>4、在左侧，如图位置加入你获得的JS代码</p>
<p><a href="https://hzy.pw/wp-content/uploads/2013/08/30829092624.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-52" alt="30829092624" src="https://hzy.pw/wp-content/uploads/2013/08/30829092624.jpg" width="325" height="437" srcset="https://hzy.pw/wp-content/uploads/2013/08/30829092624.jpg 325w, https://hzy.pw/wp-content/uploads/2013/08/30829092624-223x300.jpg 223w" sizes="auto, (max-width: 325px) 100vw, 325px" /></a></p>
<p>&nbsp;</p>
<p>5、点击保存，ok，想要再多的步骤？已经没有了！</p>
<p>具体效果可以看下方，我的这篇文章已经被自动加上了一个“赞”按钮</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/48/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">48</post-id>	</item>
		<item>
		<title>Worldpress博客添加加网、百度分享按钮（悬浮窗模式）</title>
		<link>https://hzy.pw/p/30</link>
					<comments>https://hzy.pw/p/30#comments</comments>
		
		<dc:creator><![CDATA[胡中元]]></dc:creator>
		<pubDate>Wed, 28 Aug 2013 15:27:25 +0000</pubDate>
				<category><![CDATA[网站搭建高深莫测]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>
		<guid isPermaLink="false">http://hzyisme.com/?p=30</guid>

					<description><![CDATA[Worldpress没有自带分享功能，而且在插件市场也不能找到相关插件。下面，我将教各位站长添加分享按钮 &#038;n <a class="read-more" href="https://hzy.pw/p/30">继续阅读...</a>]]></description>
										<content:encoded><![CDATA[<p style="text-align: center;"><a href="https://hzy.pw/wp-content/uploads/2013/08/0130828225920.jpg"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-35" alt="0130828225920" src="https://hzy.pw/wp-content/uploads/2013/08/0130828225920-295x300.jpg" width="295" height="300" srcset="https://hzy.pw/wp-content/uploads/2013/08/0130828225920-295x300.jpg 295w, https://hzy.pw/wp-content/uploads/2013/08/0130828225920.jpg 392w" sizes="auto, (max-width: 295px) 100vw, 295px" /></a></p>
<p>Worldpress没有自带分享功能，而且在插件市场也不能找到相关插件。下面，我将教各位站长添加分享按钮</p>
<p>&nbsp;</p>
<p><span id="more-30"></span></p>
<p>【说明】</p>
<p>使用这个方法只能添加“悬浮窗”，不能添加按钮，而且悬浮窗将在除了后台以外的所有地方出现</p>
<p>如果你需要：</p>
<p>1、添加分享按钮、赞按钮在每篇文章的末尾</p>
<p>2、希望悬浮窗只出现在文章界面，不出现在主页</p>
<p>请参考这篇文章：<a href="https://hzy.pw/?p=48">https://hzy.pw/?p=48</a></p>
<p>&nbsp;</p>
<p>1、获取JS代码</p>
<p>百度分享：<a href="http://share.baidu.com/code">http://share.baidu.com/code</a></p>
<p>加网分享：<a href="http://www.jiathis.com/getcode/">http://www.jiathis.com/getcode/</a></p>
<p>两个常用的地址，在这里我推荐百度的，因为百度还有着一个强大的数据分析平台，可以通过分享按钮获取很多用户的行为信息</p>
<p>此外，传说使用百度分享可以增加被百度搜索收录几率</p>
<p>【特别注意】必须使用“悬浮窗”的分享按钮，原因随后说明</p>
<p style="text-align: center;"><a href="https://hzy.pw/wp-content/uploads/2013/08/0130828231405.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-38" alt="0130828231405" src="https://hzy.pw/wp-content/uploads/2013/08/0130828231405.png" width="499" height="282" srcset="https://hzy.pw/wp-content/uploads/2013/08/0130828231405.png 499w, https://hzy.pw/wp-content/uploads/2013/08/0130828231405-300x169.png 300w" sizes="auto, (max-width: 499px) 100vw, 499px" /></a></p>
<p style="text-align: left;">2、打开你的博客，进入后台-外观-编辑</p>
<p style="text-align: left;"><a href="https://hzy.pw/wp-content/uploads/2013/08/231839.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-40" alt="231839" src="https://hzy.pw/wp-content/uploads/2013/08/231839.jpg" width="163" height="185" /></a></p>
<p style="text-align: left;">3、右侧的网页文件选择：footer.php</p>
<p style="text-align: left;"><a href="https://hzy.pw/wp-content/uploads/2013/08/2048.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-41" alt="2048" src="https://hzy.pw/wp-content/uploads/2013/08/2048.jpg" width="219" height="322" srcset="https://hzy.pw/wp-content/uploads/2013/08/2048.jpg 219w, https://hzy.pw/wp-content/uploads/2013/08/2048-204x300.jpg 204w" sizes="auto, (max-width: 219px) 100vw, 219px" /></a></p>
<p style="text-align: left;">5、在代码最后，body的前一行写入你得到的JS代码</p>
<p style="text-align: left;"><a href="https://hzy.pw/wp-content/uploads/2013/08/828232256.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-42 aligncenter" alt="828232256" src="https://hzy.pw/wp-content/uploads/2013/08/828232256.jpg" width="970" height="297" srcset="https://hzy.pw/wp-content/uploads/2013/08/828232256.jpg 970w, https://hzy.pw/wp-content/uploads/2013/08/828232256-300x91.jpg 300w" sizes="auto, (max-width: 970px) 100vw, 970px" /></a></p>
<p style="text-align: left;">6、保存，收工！现在在你的主页、文章，右侧都会出现悬浮分享按钮，非常好用</p>
<p style="text-align: left;">而在后台，分享按钮则不会出现</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hzy.pw/p/30/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">30</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

使用页面缓存Disk: Enhanced 
数据库缓存7/49查询，在0.026秒内使用Disk

Served from: hzy.pw @ 2026-08-12 16:38:08 by W3 Total Cache
-->