我想请求一些帮助,在Bootstrap 4网格布局中添加5个最新的帖子。我似乎就是不明白代码的意思。
有人能帮帮我吗?
我已经发布了我正在尝试做的事情的图片和代码。
View image to get an idea of what I need help with
<?php
get_template_part('content-wrapper'); ?>
<div class="row">
<!-- Real Data -->
<?php
$lastPagePosts = new WP_Query(
array('posts_per_page' => 1
));
while ($lastPagePosts->have_posts()) {
$lastPagePosts->the_post(); ?>
<div class="col-sm-12 col-lg-6 big-box">
<h2><?php the_title(); ?></h2>
<p><?php echo wp_trim_words( get_the_content() , 12 ) ?></p>
</div>
<?php } ?>
<div class="col">
<div class="row">
<?php
$topPagePosts = new WP_Query(
array('posts_per_page' => 4, 'offset' => 1 <!-- Updated this line -->
));
while ($topPagePosts->have_posts()) {
$topPagePosts->the_post(); ?>
<div class="col mini-box">
<h2><?php echo wp_trim_words( get_the_title() , 6) ?></h2>
<p><?php echo wp_trim_words( get_the_content() , 9 ) ?></p>
</div>
<?php } ?>
</div>
</div>
<!-- Dummy Data -->
<div class="col-sm-12 col-lg-6 big-box">
<h2>Latest News</h2>
<p>The big bog will display the most resent post.</p>
</div>
<div class="col">
<div class="row">
<div class="col mini-box">
<h2>Second</h2>
<p>The big bog will display the Second most resent post.</p>
</div>
<div class="col mini-box">
<h2>Third</h2>
<p>The big bog will display the Third most resent post.</p>
</div>
</div>
<div class="row">
<div class="col mini-box">
<h2>Fourth</h2>
<p>The big bog will display the Fourth most resent post.</p>
</div>
<div class="col mini-box">
<h2>Fifth</h2>
<p>The big bog will display the Fifth most resent post.</p>
</div>
</div>
</div>
</div>
<?php
.mini-box {
margin: 2px;
font-size: 1.5em;
}
转载请注明出处:http://www.xjzlzx.com/article/20230508/2189502.html