2010-11-11 76 views
0

下面是我用收集的职位代码:WordPress的 - 最新博客文章饲料出汇票

$Pages  = wp_list_pages('title_li=&echo=0&depth=1&exclude=39,190'); 
$InnerPages = wp_list_pages('child_of='.($post->post_parent != false ? $post->post_parent : $post->ID).'&title_li=&echo=0'); 
$Title  = ($post->post_parent != false) ? trim(get_the_title($post->post_parent)) : trim(wp_title('', false)); 
if($Title != '') 
    $Pages  = str_replace($Title.'</a></li>', 
          $Title.'</a>'. 
          '<ul>'.$InnerPages.'</ul></li>', 
          $Pages); 
echo $Pages; 

unset($Pages, $InnerPages); 

反正是有适应上面只显示发布的文章和排除草稿帖子?

回答

1

您可以使用get_posts()为:上述

<ul> 
<?php 
global $post; 
$tmp_post = $post; 
$myposts = get_posts('numberposts=5&offset=1&category=1'); 
foreach($myposts as $post) : 
    setup_postdata($post); 
?> 
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> 
<?php endforeach; ?> 
<?php $post = $tmp_post; ?> 
</ul> 

段来自食品服用。