WordPress调用网站最新文章

技术文档 2024年1月18日

在需要的地方使用此代码就可以实现调用wordpress最新文章

<?php
  
  query_posts("showposts=10&orderby=new"); 
//showposts表示10篇
//orderby表示排序方式
  
  while(have_posts()): the_post();
  
  ?>
  
  <li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title() ?></a></li> //这里可以写成你自己需要的样式
  
  <?php endwhile; ?>
  
  //这里可以写成你自己需要的样式

相关文章