每个 WordPress 页面都有不同的侧边栏
我正在制作一个 Wordpress 2.9.2 主题,我希望每个页面都有自己的侧边栏,可以像页面内容一样轻松编辑。为每个侧边栏制作不同的模板文件会很麻烦。添加包含所有侧边栏文本的“自定义字段”也会很奇怪,因为我无法使用 Visual/HTML 编辑器。我想要的是有一个与标签类似的标签,但它不会分隔要在首页上显示的内容,而是会拆分帖子的内容和侧边栏。这可能吗?或者有更好的解决方案吗?
I'm making a Wordpress 2.9.2 theme, and I'd like each page to have its own sidebar than can be edited as easily as the page's content. It would be cumbersome to make a different template file for each sidebar. It would also be weird to add a "custom field" containing all the sidebar text, since I wouldn't be able to use the Visual/HTML editor. What I'd like is to have a tag similar to the tag, but instead of delimiting the content to be shown on the front page, it would split the post's content and sidebar. Is this possible? Or is there a better solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使侧边栏 小部件化,而不是使用小部件逻辑插件,这样您就可以有条件地在任何和所有页面上包含小部件。
这样做可以让您利用开箱即用的小部件,这些小部件非常棒,甚至集成的第三方小部件也同样出色。
还要考虑这一点:您可以对网站的其他区域(例如标题)进行小部件化,现在可以使用小部件和小部件逻辑。这使得主题更加灵活。
Make the sidebars widgetized and than use the widget logic plugin, so you can conditionally include widgets on any and all pages.
Doing this lets you utilize the out of the box widgets, which are awesome, and even integrated third party widgets that are just as great.
Also consider this: You widgetize other areas of your site, like your header, which can now use widgets and widget logic. This makes for a more flexible theme.