5条有用的wordpress主题制作技巧

介绍10条不管是修改还是制作wordpress主题可能需要用到的基本代码技巧.

1.不在首页显示某个分类下的文章.

就像鸭脖客的博客集一样,我想让他们单独呆在一个新建的页面,而不同时在首页显示,就需要用到以下代码来排除首页文章列表中的分类.
[sourcecode language='php']
the_post();
if (is_home()) if (in_category('需要隐藏的分类ID')) continue;
?>
[/sourcecode]

2.在边栏或其他位置只显示某一分类下的文章.
[sourcecode language='php']

user_id == 1) $oddcomment = “authorcomment”; echo $oddcomment; ?>”>

[/sourcecode]

然后在css里添加
[sourcecode language='css']
.authorcomment { background-color: #555 !important; }
[/sourcecode]

整理于designer-daily

4 thoughts on “5条有用的wordpress主题制作技巧

  1. 你好,我对这个http://equilibrium.madebyon.com/installation/操作不是很明白,您能不能帮个忙给我讲解一下呀?
    我该如何做才能像他的演示一样显示主页的图片?我现在就是这个问题

    简单说,按步骤,做什么,多谢了 :-)

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>