Wordpress中的多个特定POST [英] Multiple specific POST in wordpress

查看:141
本文介绍了Wordpress中的多个特定POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在文字印刷方面遇到了问题.我想在新闻发布中显示特定的帖子,但是我不知道该怎么做,或者没有逻辑.我使用的这段代码效果很好.

So i have come with a problem in word press. I want to display specific post in word press, but i dont know how to do it, or don't have the logic. This code i use works great.

<div id="1">
// retrieve one post with an ID of 1
query_posts('p=1');

global $more;
$more = 0;
// the Loop
while (have_posts()) : the_post();
// the content of the post
the_content();
endwhile;
?>
</div>

好!现在我希望它以这种方式显示,似乎找不到逻辑来做到这一点

Good! now i want it to display like this, can't seem to find the logic how to do this

<div id="1">
// POST 1 here
</div>

<div id="2">
// POST 2 Here
</div>

<div id="3">
// POST 3 Here
</div>

谢谢

推荐答案

在这里. :)我已经修改了query_posts调用,以按ID进行排序,并按升序对其进行排序(例如:1、2、3、5、29、199等).

Here you go. :) I've modified the query_posts call to order by the ID and to order it in ascending order (eg: 1, 2, 3, 5, 29, 199 etc).

<?php
  // retrieve one post with an ID of 1
  query_posts('orderby=ID&order=ASC');

  global $more;
  $more = 0;
  // the Loop
  while (have_posts()) : the_post(); 
    ?>
      <div id="<?=get_the_ID()?>"><?=get_the_content()?></div>
    <?php
  endwhile;
?>

这篇关于Wordpress中的多个特定POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆