2014-09-30 116 views
0

我只想要一个侧边栏的onpage否则不显示任何侧边栏留空显示一个侧边栏别的不显示任何侧边栏

**<?php get_sidebar("wp-forecast") ?>** 
+0

如果条件与侧面条码 – 2014-09-30 13:53:04

+0

,你可以给我我试图找到的代码还没有得到使用。 – 2014-09-30 13:55:11

+0

您的条件显示和隐藏侧边栏是什么? – 2014-09-30 13:56:36

回答

0

你可以添加一个标志变量,并将其设置为false:

$displayed_sidebar = false 

然后包裹功能get_sidebar的内容中,检查是否displayed_sidebar是假或不的条件:

if (!$displayed_sidebar) { 

    $displayed_sidebar = true; // this prevents more than one sidebar to be displayed 

    // ... the rest of the code here ... 

}