我正在开发一个主题,其页面(以及帖子)与主页非常不同,因此我希望侧栏上有不同的小部件
有没有办法做到这一点?
我正在单曲上调用侧边栏。php就是这样,就像它在索引上一样。php:
<?php get_sidebar(); ?>
侧栏。php是这样的:<?php
/**
* The Sidebar containing the primary and secondary widget areas.
?>
<aside>
<ul>
<?php
/* When we call the dynamic_sidebar() function, it\'ll spit out
* the widgets for that widget area. If it instead returns false,
* then the sidebar simply doesn\'t exist, so we\'ll hard-code in
* some default sidebar stuff just in case.
*/
if ( ! dynamic_sidebar( \'primary-widget-area\' ) ) : ?>
<?php endif; // end primary widget area ?>
</ul>
<?php
// A second sidebar for widgets, just because.
if ( is_active_sidebar( \'secondary-widget-area\' ) ) : ?>
<ul>
<?php dynamic_sidebar( \'secondary-widget-area\' ); ?>
</ul>
<?php endif; ?>
</aside>