获取本周发布的WordPress文章列表

知更鸟 WordPress2301阅读模式

获取本周发布的WordPress文章列表。

文章源自知更鸟-https://zmingcx.com/get-this-weeks-wordpress-article.html

获取本周发布的WordPress文章列表

获取本周发布的WordPress文章列表

文章源自知更鸟-https://zmingcx.com/get-this-weeks-wordpress-article.html

<?php
	$args = array(
		'posts_per_page' => '20', // 篇数
		'ignore_sticky_posts' => true,
		'date_query' => array(
			array(
				'year' => date( 'Y' ),
				'week' => date( 'W' ),
			),
		),
	);
	$query = new WP_Query( $args );
?>
<ul>
	<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();?>
		<li>
			<?php the_title( sprintf( '<a class="title" href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a>' ); ?>
		</li>
	<?php endwhile;?>
	<?php wp_reset_postdata(); ?>
	<?php else : ?>
		<li>
			暂无更新
		</li>
	<?php endif;?>
</ul>
获取WordPress当日发布的文章列表。 <?php $today = getdate(); $args = arr...
138
如果需要调用一定时间段内的WordPress文章,可以通过下面的代码实现。 <?php $cat = '2'; // ...
110
文章源自知更鸟-https://zmingcx.com/get-this-weeks-wordpress-article.html文章源自知更鸟-https://zmingcx.com/get-this-weeks-wordpress-article.html
weinxin
我的微信
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论  2  访客  2
    • 优惠电影票预定
      优惠电影票预定 2

      请问下首页幻灯片的设置了小的,哪一部分的图片有规格吗?自己设置了一直都显示不全。

      • 芊芊精典
        芊芊精典 2

        应该是350X260 后台有个幻灯片小工具,可以参考那个尺寸

      匿名

      发表评论

      匿名网友 填写信息

      :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

      确定