wordpress 使用 WP_Query 实现最新n条文章

<?php 
					   $post_query = new WP_Query('showposts=10');
					   while($post_query->have_posts()) : $post_query->the_post();
					   $do_not_duplicate  = $post_ID;?>
					<li class="media">
                        <div class='media-header'>
                        	 <img src="static/picture/u=3860383438,3596170004&amp;fm=26&amp;gp=0.jpg"   height='150' width='250' class="mr-3 d-none d-sm-block" alt="...">
                        	<div class='tags' style='width:97%'>
                        		<span><span class='text-warning'>&nbsp;</span>前端</span>
                        		<time><span class='text-primary'> </span><?php the_time('Y-m-d H:i:s')?></time>
                        		<span><span class='text-secondary'> </span>浏览(0)</span>
                        		<span><span class='text-info'>&nbsp;</span><?php the_author()?></span>
                        		<span class='float-right '><a href="<?php the_permalink()?>" class='text-success'>++阅读原文</a></span>
                        	</div>
                        </div>
			    		<div class="media-body">
					      <h5 class="mt-0 mb-1 h5"><?php the_title();?></h5>
							<?php the_content();?>
						</div>
					</li>
					<?php endwhile;?>

WP_Query更多配置参考 https://www.boke8.net/wordpress-wp_query.html

个人博客 :https://www.zihanzy.com 欢迎来访

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值