Php 将侧边栏与我的主要内容引导对齐
我正在使用Bootstrap和WordPress创建一个网站。我有一个我的主要内容是8列,然后我的侧边栏是4列。在我的普通页面上,我将它们都放在一行中,以便它们正确对齐。然而,在这个页面上,我使用WordPress循环创建了许多行,其中包含内容,这意味着我的侧边栏与我的内容不在同一行中,并在屏幕上被推到它的下方。可以将它们水平对齐吗 这是我正在使用的代码Php 将侧边栏与我的主要内容引导对齐,php,html,css,wordpress,twitter-bootstrap,Php,Html,Css,Wordpress,Twitter Bootstrap,我正在使用Bootstrap和WordPress创建一个网站。我有一个我的主要内容是8列,然后我的侧边栏是4列。在我的普通页面上,我将它们都放在一行中,以便它们正确对齐。然而,在这个页面上,我使用WordPress循环创建了许多行,其中包含内容,这意味着我的侧边栏与我的内容不在同一行中,并在屏幕上被推到它的下方。可以将它们水平对齐吗 这是我正在使用的代码 <?php if ( $wp_query->have_posts() ) : while ( $wp_query->have
<?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div class="row case-studies">
<div id="page_content">
<div class="col-md-8">
<div class="case_summary_image col-md-4">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('casestudy img-responsive');?></a>
</div>
<div class="case_summary col-md-8"></a>
<a style="font-size:18px; line-height:30px; color:#666666; font-weight:bold; text-decoration:none" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<!-- sidebar -->
<?php endwhile; endif; ?>
<div class="col-md-4">
<?php get_sidebar();?>
</div>
您仍然需要一个容器或一行来包含内容和侧栏,以使列按您所希望的方式工作。您必须创建循环主区域并向其中添加类。所以
<div class="col-md-8">
<!-- your loop, wp query -->
</div>
<div class="col-md-4">
<!-- your theme sidebar -->
</div>
总之,您必须有一个col-md-8和一个col-md-4。为什么不将循环放在行中,以便一行包含在
col-md-8
和侧边栏中生成的内容,但内容在col-md-8
中?