2012-02-10 35 views
1

所以我在文字按下时遇到了问题。我想在文字按下显示特定的文章,但我不知道如何去做,或者没有逻辑。我使用的这段代码很棒。在wordpress中的多个特定的POST

<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> 

好!现在我希望它显示这个样子,似乎无法找到逻辑如何做到这一点

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

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

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

谢谢

回答

1

在这里你去。 :)我已经修改了query_posts调用订单的ID并按升序(例如:1,2,3,5,29,199等)进行订购。

<?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; 
?> 
+0

不错,谢谢:) – tomexsans 2012-02-10 15:30:26

相关问题