1

我有一个侧边栏,我想将其放在内容的左侧。我已经尝试了所有我能想到的方法,但无法让侧边栏显示在页面的左侧。

    <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
4

1 回答 1

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%;
}
于 2013-09-22T06:59:06.190 回答