站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Customizing Your Sidebar
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
==不同的边栏Anyone?== Sidebars come and sidebars go...well, at least they do in the WordPress Default Theme. View the front, archive, or category page and you will see the sidebar. Click on a post title and view the post and you will see the sidebar disappear. How did this magic trick happen? 边栏出现,消失…至少,在WordPress默认主题中是这样的。查看字体,归档,或者类别网页,你就会看到边框。点击文章标题,阅读文章,你会发现边栏不见了。这种神奇的操作是怎样实现的? WordPress 1.5 uses modular [[WordPress:Templates|template files]] for the different parts and pieces of a site. We are currently discussing one of them, the <tt>sidebar.php</tt>. Some Themes feature different web pages beyond the <tt>index.php</tt> such as <tt>archive.php</tt>, <tt>single.php</tt>, <tt>search.php</tt>, and <tt>category.php</tt>. Each of these post pages can feature different sidebars, headers, and footers. Do you want to have the sidebar change dependent upon whether someone is viewing a category, archive, or the front page? We'll show you how. WordPress1.5为站点的不同部分不同模块,使用模块[[WordPress:Templates|模板文件]],我们当前讨论其中的一个,<tt>sidebar.php</tt>。有些主题除了<tt>index.php</tt>外,拥有不同的网页,如<tt>archive.php</tt>, <tt>single.php</tt>, <tt>search.php</tt>, and <tt>category.php</tt>。每个文章网页都拥有不同的边栏,标头,和页底文字。你想要根据人们在浏览类别,归档以及首页时的不同情况来更改边栏吗?下面我们向你显示怎样更改。 By default, the call for the sidebar is: 默认情况下,调用边栏的命令是: <?php get_sidebar(); ?> <?php get_sidebar(); ?> In the WordPress Default Theme, the <tt>single.php</tt> template file does not request a sidebar. If you view a single post, you will see that the post stretches across the space where the sidebar would have been. Click back to an archive, category, or the front page and the sidebar returns. This Theme has removed the call for the sidebar. 在WordPress默认主题中,<tt>single.php</tt>模板文件不需要边栏。如果你访问一篇单一的文章,你将会看到文章延伸在本应该出现边栏的位置。返回到归档,类别或者首页,边栏又会返回。这个主题已经移除了边栏的命令。 To have a sidebar be different on a different template page, instead of using the default template tag, you can use the PHP command INCLUDE. 要使得边栏在不同的模板网页上看起来不同,你可以使用PHP命令INCLUDE而不是使用默认模板标签。 <?php include ('sidebar2.php'); ?> <?php include ('sidebar2.php'); ?> Placed on the <tt>single.php</tt> or the <tt>category.php</tt> template file instead of the default tag, this different sidebar would appear on those web pages. You can then customize <tt>sidebar2.php</tt> to feature whatever information you would like so that it is different than the default sidebar. 将边栏放置在<tt>single.php</tt> 或者 <tt>category.php</tt>模板文件而不是默认标签上,这个不同的边栏就会出现在这些网页上。然后你可以自定义<tt>sidebar2.php</tt>放入任何你想要的信息,这样边栏就与默认的边栏不同了。 If you would like to have a different sidebar on the <tt>single.php</tt> template file, and another different sidebar visible when viewing an archive or category, edit the <tt>archive.php</tt> or <tt>category.php</tt> template files and change the sidebar call to: 如果你希望<tt>single.php</tt>模板文件上拥有一个不同的边栏,而且当你访问归档或者类别的时候,可以看到其它的不同的边栏,请编辑<tt>archive.php</tt>或者<tt>category.php</tt>模板文件并且将边栏命令更改为: <?php include ('sidebar-cat.php'); ?> <?php include ('sidebar-archive.php'); ?> <?php include ('sidebar-cat.php'); ?> <?php include ('sidebar-archive.php'); ?> Actually, you can use whatever name you want. You can also set up [[WordPress:The Loop]] to call different sidebars dependent upon what you are viewing, and you can learn more about this technique in the WordPress Lesson on Exploring the Loop. You've got the basic idea, and from here, it's up to your imagination. 事实上,你可以使用任何你想要的名称。你也可以设置[[WordPress:The Loop|The Loop]]根据你浏览的不同内容,调用不同的边栏,你可以在WordPress课程中,探索Loop部分,学习这方面的内容。你已经了解了基本的内容,从现在开始,所有操作都取决于你的想像力了。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)