2014-09-30 96 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 ... 

}