【发布时间】:2016-01-13 22:42:46
【问题描述】:
如何为 wordpress 主题制作右侧边栏并与高级搜索集成,如下面的概念:
sidebar.php
<?php
/**
* The sidebar containing the main widget area.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package custom
*/
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div id="tertiary" class="widget-area" role="supplementary">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- #secondary .widget-area -->
<?php endif; ?>
侧边栏的style.css
#secondary { /* left Sidebar */
width: 18rem;
margin-left: -67rem;
float: left;
position: relative;
}
#tertiary { /* right Sidebar */
width: 18rem;
margin-right: -23rem;
float: right;
position: relative;
}
我怎样才能以简单的方式实现它?
【问题讨论】:
标签: php html css wordpress wordpress-theming