WordPress边栏位于帖子下方

时间:2015-12-11 01:36:43

标签: php wordpress

This 是我的网站我不知道为什么我的侧边栏没有显示在旁边,它已经下降。请任何人帮我解决这个问题。

index.php

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Trevelle
 */

get_header(); ?>
<div class="background">
 <div class="container padding-top">
        <div class="row" id="primary">
            <main id="content" class="col-sm-8">
                <?php if ( have_posts() ) : ?>

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php

                    /*
                     * Include the Post-Format-specific template for the content.
                     * If you want to override this in a child theme, then include a file
                     * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                     */
                    get_template_part( 'template-parts/content', get_post_format() );
                ?>

            <?php endwhile; ?>

            <?php the_posts_navigation(); ?>

        <?php else : ?>

            <?php get_template_part( 'template-parts/content', 'none' ); ?>

        <?php endif; ?>
            </main>
      <aside class="col-sm-4 lead text">
        <?php get_sidebar(); ?>
        </aside>
            </div>
            </div>
</div>

<?php get_footer(); ?>

这是CSS,因为它冗长http://jsfiddle.net/go75571m/

1 个答案:

答案 0 :(得分:0)

已编辑,所有新答案:

您的主题CSS包含一个打破底层引导程序CSS的设置。 找到以下文件并将其打开: &#34; /trevelle/wp-content/themes/trevelle/style.css"

在该文件的第2492 - 2497行,您会找到以下规则:

main {
padding:25px;
margin:10px 5px;
color:black;
line-height:30px;
}

在那里,改变

margin10px 0;

这应该可以解决问题。我不知道主题中是否有一点错误,或者错误的行为是否也是由其他原因引起的,但是现在,这将解决它。

主要元素左右两侧的5px边距稍微过多:66,6667%宽度(主要)加上33,3333%宽度(旁边)= 100% PLUS 那些10px只是不适合周围的容器...