php - 显示集合类别中的第二个和第三个最近的博客文章
问题描述
<?php
$args = array( 'numberposts' => 3, 'order'=> 'ASC', 'orderby' => 'title', 'category' => '136');
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="col-webinar-blocks">
<div class="list-card">
<div class="list-card-content">
<h3><?php the_title(); ?></h3>
<p><?php the_field('list_view_description'); ?></p>
<div class="list-card-button">More Info</div>
</div>
</div>
</div>
<?php endforeach; ?>
我有上面的代码,它成功地从类别 ID 136 中提取了前 3 个博客。太棒了!
但是,有没有办法只通过第二和第三?我不想使用 css(如果可能的话。)
如何在 WordPress 中显示一个类别中的第二和第三个最新帖子- 这种工作但不会拉过我所追求的一个类别,而只是拉过所有帖子。
任何帮助深表感谢!
解决方案
推荐阅读
- c# - 应用程序工作并冻结时更改表单
- pandas - 将数据框添加到特定行和列的现有数据框
- azure - Azure VM 到 Azure Blob 存储数据传输成本
- python - 更改熊猫数据框中随机选择的行的顺序
- google-colaboratory - Google Colab 没有实现模型训练
- python - 在 Python 中使用 QtGui.QPainter() 更改点对象的颜色
- xamarin.forms - Xamarin Forms Shell 标题栏颜色在深色主题中未正确设置
- javascript - 使用js打印图案
- javascript - 过渡效果仅在 Firefox 中有效
- php - 图像不保存到临时文件夹但保存到数据库