站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Tag Templates
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
===一些类别页面上的不同的文本 === A slightly more complex possibility is that you want different text to display depending on which category page the visitor is viewing. Then you would add the "default" text to the main <tt>category.php</tt> file, and create special <tt>category-#.php</tt> files (with their own version of the text, as described in the Introduction) for each category that needs special text at the top. 稍微复杂的情况是,根据访客浏览不同的类别页面,你希望显示不同的文本。那么你将要将"默认"文本添加到主要的<tt>category.php</tt>文件,并且为需要在顶上方出现特别文本的每个类别,创建特别的<tt>category-#.php</tt>文件(带有自己版本的文本,如介绍中所描述的)。 This does however create a lot of files in your theme directory, and can be avoided using the following code '''OUTSIDE''' the loop: 这样,在你的主题目录中创建了许多文件,而且可以避免在loop '''外'''使用下面的代码: <pre><nowiki> <?php if (is_category('Category A')) { ?> <p>This is the text to describe category A</p> <?php } elseif (is_category('Category B')) { ?> <p>This is the text to describe category B</p> <?php } else { ?> <p>This is some generic text to describe all other category pages, I could be left blank</p> <?php } ?> </nowiki></pre> <pre><nowiki> <?php if (is_category('Category A')) { ?> <p>这是描述类别A的文本</p> <?php } elseif (is_category('Category B')) { ?> <p>这是描述类别B的文本</p> <?php } else { ?> <p>这是描述所有其它类别页面的一般文本,我可以保留为空白 </p> <?php } ?> </nowiki></pre> This does the following. Checks to see if we are looking at Category A, if we are then show the first bit of text, but if we're not then check if we are looking at Category B. If we are then show that bit of text, and finally, if it is neither Category A or B, then show this default text. 这个代码执行以下的操作。查看我们是否在查找类别A,如果我们是在查找类别A,我们会显示一些文本,如果我们不是在查找类别A,代码就会查看我们是否在查找类别B。如果我们那时显示那点文本,而且最后,如果既不是类别A也不是类别B,那么就显示这个默认文本。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)