来自Joomla背景,我意识到的第一件事之一是Wordpress 3不支持控制小部件的可见性(Joomla中的模块)。
我试过:
有人能推荐一个解决方案吗?
发布于 2010-11-26 11:25:34
发布于 2012-04-11 00:20:46
您可以使用显示小部件。它向每个小部件添加复选框,以便在每个站点页面上显示或隐藏它:http://wordpress.org/extend/plugins/display-widgets/screenshots/
确保禁用其他类似插件以避免冲突。
发布于 2010-11-26 12:32:47
来自sidebar.php的示例:
<div class="sidebar-box border-radius-6px">
<h2>Dream Categories</h2>
<ul>
<?php wp_list_categories('title_li='); ?>
</ul>
</div><!-- Sidebar Box End -->假设您只想在一个名为"about-us“的页面上显示这个信息。使用wordpress提供的is_page()函数。
<?php if(is_page('about-us')) { ?>
<div class="sidebar-box border-radius-6px">
<h2>Dream Categories</h2>
<ul>
<?php wp_list_categories('title_li='); ?>
</ul>
</div><!-- Sidebar Box End -->
<?php } ?>至于用户级别:
<?php if(current_user_can('level_10')) { // Level 10 = Administrator ?>
<div class="sidebar-box border-radius-6px">
<h2>Dream Categories</h2>
<ul>
<?php wp_list_categories('title_li='); ?>
</ul>
</div><!-- Sidebar Box End -->
<?php } ?>PS:我看到了aendrew提供的插件,我看了一下。尝试如下:备份widget_login.php文件,然后打开它,搜索第75行,并将其替换为update_option("widget_logic",“is_page(‘)”)。$wl_options。“‘));如果您限制了一个小部件,您必须在输入中添加is_page('bla-bla') (如果页面名为Bla),那么该行应该只需要 Bla (如果页面名为Bla),但您可以尝试一下。
https://stackoverflow.com/questions/4284649
复制相似问题