我只需要一个侧边栏页面,否则不显示任何侧边栏留空
**<?php get_sidebar("wp-forecast") ?>**
You could add a flag variable and set it to false:
$displayed_sidebar = false
Then wrap the content of the function get_sidebar
in a condition that checks if displayed_sidebar
is false or not:
if (!$displayed_sidebar) {
$displayed_sidebar = true; // this prevents more than one sidebar to be displayed
// ... the rest of the code here ...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.