<?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>DFdou&#039;s Blog &#187; Hack</title>
	<atom:link href="http://nwhy.org/tag/hack/feed" rel="self" type="application/rss+xml" />
	<link>http://nwhy.org</link>
	<description>Life is short,Be yourself.</description>
	<lastBuildDate>Thu, 29 Jul 2010 02:10:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CSS-区分IE6,IE7,Firefox Hack</title>
		<link>http://nwhy.org/css-ie6-ie7-firefox-hack.html</link>
		<comments>http://nwhy.org/css-ie6-ie7-firefox-hack.html#comments</comments>
		<pubDate>Tue, 22 Dec 2009 11:26:27 +0000</pubDate>
		<dc:creator>DFdou</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hack]]></category>

		<guid isPermaLink="false">http://nwhy.org/?p=5107</guid>
		<description><![CDATA[以下内容来自http://www.div-css.com/html/XHTML-CSS/hack/1136667.html 区别IE6与FF： background:orange;*background:blue; 区别IE6与IE7： background:green !important;background:blue; 区别IE7与FF： background:orange; *background:green; 区别... ]]></description>
			<content:encoded><![CDATA[<p>以下内容来自http://www.div-css.com/html/XHTML-CSS/hack/1136667.html</p>
<p>区别IE6与FF：<br />
background:orange;*background:blue;</p>
<p>区别IE6与IE7：<br />
background:green !important;background:blue;</p>
<p>区别IE7与FF：<br />
background:orange; *background:green;</p>
<p>区别FF，IE7，IE6：<br />
background:orange;*background:green !important;*background:blue;<br />
注：IE都能识别*;标准浏览器(如FF)不能识别*；</p>
<p>IE6能识别*，但不能识别 !important,<br />
IE7能识别*，也能识别!important;<br />
FF不能识别*，但能识别!important;</p>
<p>另外再补充一个，下划线"_",<br />
IE6支持下划线，IE7和firefox均不支持下划线。</p>
<p>于是大家还可以这样来区分IE6，IE7，firefox:<br />
background:orange;<br />
*background:green;<br />
_background:blue;</p>
<p>注：不管是什么方法，书写的顺序都是firefox的写在前面，IE7的写在中间，IE6的写在最后面。</p>
<h4  class="related_post_title">Some Related Posts</h4><ul class="related_post"><li>2009/11/30 -- <a  href="http://nwhy.org/css-sprite.html" title="CSS-CSS Sprite 图片合并技术">CSS-CSS Sprite 图片合并技术</a> (0)</li><li>2009/10/23 -- <a  href="http://nwhy.org/13-css-editor-help-you-create-perfect-website.html" title="13+ CSS Editor Help You Create Perfect Website">13+ CSS Editor Help You Create Perfect Website</a> (0)</li><li>2009/06/03 -- <a  href="http://nwhy.org/jquery-drop-down-menu-effect-with-jquery-css.html" title="jQuery-Drop Down Menu Effect With jQuery &#038; CSS">jQuery-Drop Down Menu Effect With jQuery &#038; CSS</a> (0)</li><li>2009/05/26 -- <a  href="http://nwhy.org/two-sticky-footer-pure-css-solutions.html" title="CSS-Two &#8220;Sticky Footer&#8221; Pure-CSS Solutions">CSS-Two &#8220;Sticky Footer&#8221; Pure-CSS Solutions</a> (0)</li><li>2009/05/06 -- <a  href="http://nwhy.org/wordpress-cms-hacks-and-tricks.html" title="WordPress-CMS Hacks and Tricks">WordPress-CMS Hacks and Tricks</a> (4)</li><li>2009/04/20 -- <a  href="http://nwhy.org/css-tools-reset-css.html" title="CSS Tools-Reset CSS">CSS Tools-Reset CSS</a> (0)</li><li>2009/04/09 -- <a  href="http://nwhy.org/css-naked-day.html" title="CSS Naked Day!">CSS Naked Day!</a> (2)</li><li>2009/04/01 -- <a  href="http://nwhy.org/flash-css-stylesheet.html" title="Flash-CSS,StyleSheet">Flash-CSS,StyleSheet</a> (0)</li><li>2008/12/15 -- <a  href="http://nwhy.org/ie6-absolute-bug.html" title="IE6的absolute Bug">IE6的absolute Bug</a> (0)</li><li>2008/08/06 -- <a  href="http://nwhy.org/drupal-node-tpl-php.html" title="Drupal模板页node.tpl.php/样式定制">Drupal模板页node.tpl.php/样式定制</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://nwhy.org/css-ie6-ie7-firefox-hack.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress-CMS Hacks and Tricks</title>
		<link>http://nwhy.org/wordpress-cms-hacks-and-tricks.html</link>
		<comments>http://nwhy.org/wordpress-cms-hacks-and-tricks.html#comments</comments>
		<pubDate>Wed, 06 May 2009 01:49:13 +0000</pubDate>
		<dc:creator>DFdou</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nwhy.org/?p=4255</guid>
		<description><![CDATA[Something learned from WordPress CMS Hacks and Tricks 1. Create a static home page 使用一个静态页面作为首页 By default, a WordPress home page shows chronological blog post entries — with the most recent post at the top. If your goal is to h... ]]></description>
			<content:encoded><![CDATA[<p>Something learned from <a  href="http://www.noupe.com/wordpress/powerful-cms-using-wordpress.html">WordPress CMS Hacks and Tricks</a></p>
<h4 class="title">1. Create a static home page 使用一个静态页面作为首页</h4>
<p>By default, a WordPress home page shows chronological blog post entries — with the most recent post at the top. If your goal is to have a WP-created Page with static information, WordPress will allow you to select a different page as your home page so that you can display more traditional content like information about yourself or your business.<br />
<strong>How To »</strong><br />
In your admin area, just go to <strong class="red">Setting</strong> » <strong class="red">Reading</strong>. Here you can decide if your home page will display your blog posts or a static page, if you choose a static page you can also choose which page to be your home page from the select box.<br />
做法很简单，在后台Reading Setting里选择Front Page为你写的Page就可以了。</p>
<h4 class="title">2. Customized Navigation bar 自定义导航栏</h4>
<p>Adding too many pages to a WordPress blog that has a navigation bar in the header can really make your WordPress blog a mess. There are options to control what pages are shown in the navigation bar and even a way to add external links.<br />
<strong>How To »</strong><br />
The Template Tag, <a  href="http://codex.wordpress.org/Template_Tags/wp_list_pages">wp_list_pages()</a>, displays a list of WordPress Pages as links. It is often used to customize the Sidebar or Header. You can simply edit the <strong class="red">header.php</strong> file and exclude any page id you want, you can also include the pages you want. So now the code of the top nav bar will look like this:<br />
<span id="more-4255"></span></p>
<pre class="brush: html">
&lt;ul id=&quot;pagenav&quot;&gt;
       &lt;li class=&quot;&lt;?php if ( is_home() ) { echo &#039;current_page_item&#039;; } ?&gt;&quot;&gt;
             &lt;a href=&quot;&lt;?php bloginfo(&#039;url&#039;); ?&gt;&quot; title=&quot;&lt; ?php bloginfo(&#039;name&#039;); ?&gt;&quot;&gt;Home&lt;/a&gt;
       &lt;/li&gt;
       &lt; ?php wp_list_pages(&#039;sort_column=menu_order&amp;depth=1&amp;title_li=&amp;exclude=17,38&#039; ); ?&gt;
&lt;/ul&gt;
</pre>
<p><strong>Creating Two-Tiered Conditional Navigation in WordPress  »</strong><br />
A common navigational scheme, parent pages on top and child pages (if they exist) on bottom:父子级菜单形式上下层分布<br />
<strong>How To »</strong><br />
<a  href="http://www.darrenhoyt.com/2008/02/12/creating-two-tiered-conditional-navigation-in-wordpress/">Darren Hoyt</a> goes through a nice solution to help us: 1) query the page, 2) determine if there are child pages, and 3) properly highlight both the <strong class="red">.current_page_parent</strong> and <strong class="red">.current_page_item links</strong>.</p>
<pre class="brush: html">
&lt;ul id=&quot;nav&quot;&gt;
&lt; ?php wp_list_pages(&#039;title_li=&amp;depth=1&#039;); ?&gt;
&lt;/ul&gt;
&lt; ?php if($post-&gt;post_parent)
$children = wp_list_pages(&quot;title_li=&amp;child_of=&quot;.$post-&gt;post_parent.&quot;&amp;echo=0&quot;); else
$children = wp_list_pages(&quot;title_li=&amp;child_of=&quot;.$post-&gt;ID.&quot;&amp;echo=0&quot;);
if ($children) { ?&gt;
&lt;ul id=&quot;subnav&quot;&gt;
&lt; ?php echo $children; ?&gt;
&lt;/ul&gt;
&lt; ?php } else { ?&gt;
&lt; ?php } ?&gt;
</pre>
<p>And then he show us how to use CSS to make sure the :active and :hover states display correctly whether or not subpages exist — if they do, the primary nav uses <strong class="red">current_page_parent</strong>, if they don’t, it resorts to simply <strong class="red">current_page_item</strong>.<br />
<strong>Use breadcrumbs</strong><br />
Breadcrumbs are great for so many reasons: usability, SEO, etc. In terms of plugins, there are many options, my favorite is <a  href="http://yoast.com/wordpress/breadcrumbs/">Yoast’s Breadcrumbs</a>, because it’s easy to implement. Another <a  href="http://justintadlock.com/archives/2009/04/05/breadcrumb-trail-wordpress-plugin">breadcrumbs plugin</a>, gives you a new template tag called breadcrumb_trail() that you can place anywhere in your theme. Once that’s done, it’ll display a hierarchical menu of where the current visitor is on your site. It’s quite useful if you have more than a few pages or posts.</p>
<h4 class="title">3. How to widgetize your theme 关于widgetize的部分</h4>
<p>方便调用内容用的，可以自己写些Widgets到Function里，在需要输出的地方输出内容。<br />
<a  href="http://codex.wordpress.org/Plugins/WordPress_Widgets">WordPress Widgets</a> are also known as “sidebar accessories” which are WordPress Plugins or add-ons to your WordPress blog sidebar. This could come in handy for your client, WordPress Widgets allow the easy addition of design elements, gadgets, content, images, and more to your WordPress sidebar to personalize the blog without knowing HTML, PHP, or any code.</p>
<h4 class="title">4. Custom post and page templates 很重要的一点，关于模板的问题</h4>
<p>有时候我们可能需要对某个分类，或者某个ID的日志进行不同的排版处理，这个时候就需要用到这点了。<br />
关于WP的模板机制，曾经写过一个文章，有兴趣的可以查看<a  href="http://nwhy.org/wordpress-template-system.html">“WordPress -Template System模板系统”</a>。<br />
下边是补充内容，假设我们要对分类ID为13的分类全部使用不同的single页面，那么代码应该是这样：</p>
<pre class="brush: php">
&lt; ?php
$post = $wp_query-&gt;post;
if ( in_category(&#039;13&#039;) ) {
include(TEMPLATEPATH . &#039;/single13.php&#039;);
} else {
include(TEMPLATEPATH . &#039;/single1.php&#039;);
}
?&gt;
</pre>
<p>如果你想对某一个分类(假设分类ID为13)使用不同的分类展示页，那么应该建立category-13.php的模板页。</p>
<h4 class="title">5. Permalink Structure 永久链接结构</h4>
<p><a  href="http://codex.wordpress.org/Using_Permalinks">Permalinks </a>are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. We won’t go through the usual techniques to how to beautify your links and get rid of the post id at the end of the url, display date, etc…<br />
关于这个其实比较难讲，有些网站使用的是日期+日志标题的格式(比如techcrunch.com)，也有使用分类+日志标题的格式(比如noupe.com)，nwhy.org使用的是日志标题的形式，用的WP-slug的插件，自己输入slug或者由Google的翻译引擎翻译。<br />
对于分类部分，使用了Top Level Categories+Permalink Redirect，有兴趣的可以参考<a  href="http://nwhy.org/wordpress-plugins-of-nwhyorg.html">“WordPress Plugins-nwhy.org使用的插件列表”</a>。</p>
<h4 class="title">6. Create a sitemap for the whole website 建立网站地图</h4>
<p><a  href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML Sitemaps</a>- This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog. It supports all of the WordPress generated pages as well as custom ones. Everytime you edit or create a post, your sitemap is updated and all major search engines that support the sitemap protocol, like ASK.com, Google, MSN Search and YAHOO, are notified about the update.<br />
这方面使用Google XML Sitemaps就OK了。<br />
===============================================================<br />
PS：删掉了部分个人觉得没有必要的内容，有兴趣的请查看原文。</p>
<h4  class="related_post_title">Some Related Posts</h4><ul class="related_post"><li>2009/07/06 -- <a  href="http://nwhy.org/wordpress-some-special-error.html" title="WordPress-一些奇怪的错误Some Special Error ">WordPress-一些奇怪的错误Some Special Error </a> (1)</li><li>2009/06/19 -- <a  href="http://nwhy.org/introduce-wordpress.html" title="介绍下WordPress ">介绍下WordPress </a> (1)</li><li>2009/06/04 -- <a  href="http://nwhy.org/wordpress-plugins-role-manage.html" title="15款WordPress角色权限管理插件 | 转载自帕兰映像">15款WordPress角色权限管理插件 | 转载自帕兰映像</a> (0)</li><li>2009/05/07 -- <a  href="http://nwhy.org/wordpress-plugins-wp-super-cache.html" title="WordPress Plugins-WP Super Cache使用介绍">WordPress Plugins-WP Super Cache使用介绍</a> (2)</li><li>2009/03/28 -- <a  href="http://nwhy.org/wordpress-plugins-optimize_db.html" title="WordPress Plugins-Optimize DB">WordPress Plugins-Optimize DB</a> (0)</li><li>2009/02/06 -- <a  href="http://nwhy.org/wordpress-plugins-wp2twitter.html" title="WordPress Plugins-Wp-to-twitter">WordPress Plugins-Wp-to-twitter</a> (2)</li><li>2009/02/06 -- <a  href="http://nwhy.org/wordpress-plugins-fanfouportable.html" title="WordPress Plugins-Fanfouportable">WordPress Plugins-Fanfouportable</a> (0)</li><li>2009/02/04 -- <a  href="http://nwhy.org/wordpress-plugins-of-nwhyorg.html" title="WordPress Plugins-nwhy.org使用的插件列表">WordPress Plugins-nwhy.org使用的插件列表</a> (0)</li><li>2009/02/04 -- <a  href="http://nwhy.org/wordpress-safety.html" title="WordPress-10步增加WP的后台安全性">WordPress-10步增加WP的后台安全性</a> (2)</li><li>2009/02/03 -- <a  href="http://nwhy.org/wordpress-plugins-twitter-updater.html" title="WordPress Plugins-Twitter Updater">WordPress Plugins-Twitter Updater</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://nwhy.org/wordpress-cms-hacks-and-tricks.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
