我有一个 WordPress 帖子,每次我发布它时,我的 3 列 html 网格都完全搞砸了(东西向左浮动,网格中应该有一个元素的间隙。)但是当我删除帖子并刷新页面时网格的格式完全符合应有的格式。
这是主循环:
<div id="howTo" class="howTo">
<div class="small-12 columns mainWrap">
<h1 class="text-center"><span class="cb-howTo"></span>Skills</h1>
<?php $loop = new WP_Query( array( 'order' => 'asc', 'category_name' => 'des-skill') ); ?>
<?php if ( have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="<?php the_permalink(); ?>">
<div class="small-12 medium-4 columns article">
<div class="articleImgWrap dzsparallaxer auto-init use-loading" data-options='{ direction: "normal" }' role="banner">
<div class="articleImg dzsparallaxer--target" style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>');"></div>
<div class="imgOverlay">
<h4 class="text-center articleHead"><?php the_title(); ?></h4>
</div>
</div>
<div class="excerpt"><?php echo get_the_excerpt(); ?></div>
</div>
</a>
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
</div>
</div>
我正在使用粉底,但是当我删除那个帖子时,网格又没问题了。
最佳答案
问题是我认为 WordPress 在帖子标题中看到像 < 和 > 这样的字符是打开和关闭 html 元素的部分。所以我认为正在发生的事情是它过早地关闭了循环中的 html 元素。尝试从帖子标题中删除“>”,看看是否能解决网格问题。
关于html - WordPress 帖子搞乱了 html 网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37194355/