欢迎来到站长天空!

WordPress

当前位置: 主页 > CMS教程 > WordPress

wordpress无插件调用随机文章的方法

时间:2025-10-18 16:47:34|栏目:WordPress|点击:

wordpress无插件调用随机文章的方法如下:

<ul> 
<?php 
global $post; 
$postid = $post->ID; 
$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 10); 
$query_posts = new WP_Query(); 
$query_posts->query($args); 
?> 
<?php while ($query_posts->have_posts()) : $query_posts->the_post(); ?> 
<li><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></a></li> 
<?php endwhile; ?> 
</ul>


上一篇:wordpress移除文章图片的宽度和高度属性

栏    目:WordPress

下一篇:wordpress无插件调用最新文章的方法

本文标题:wordpress无插件调用随机文章的方法

本文地址:https://zz.feitang.co/CMSjiaocheng/25061.html

广告投放 | 联系我们 | 版权申明

申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:257218569 | 邮箱:257218569@qq.com

Copyright © 2018-2025 站长天空 版权所有 Powered by EyouCms冀ICP备14023439号