Wordpress侧边栏定位

时间:2013-09-22 06:01:58

标签: html css wordpress stylesheet

我有一个侧边栏,我想在我的内容的左侧定位。我已经尝试了所有我能想到的但却无法在页面的左侧显示侧边栏。

    <div class="container">
        <header>

        </header>
    <?php if ( is_active_sidebar( 'primary' ) )  {?>
 <div class='cats'>
    <?php dynamic_sidebar( 'primary' );  } ?>
  </div>
        <div class='content_wrapper'>
        <?php if ( have_posts() ) : ?>
        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>

        <div class="posts">
            <article>
               <div class="wrapper">
               <h2 class='headline'><a href="<?php the_permalink() ?>"></h2>

                <div class='thumbs'>

                <p><?php echo content('120'); ?></p>
            </article>
            //.....
                    // some code
               </div>
            </div>
         ... some more code

1 个答案:

答案 0 :(得分:1)

Please Put this after header, so you can have sidebar at left

<?php get_sidebar(); ?>

和动态侧栏使用此css

.container
{
    margin:auto!important;
}
.cats
{
    float:left;
    width:30%;
}
.content_wrapper
{
    float:right;
    width:68%;
}
相关问题