Php 将帖子限制为特定类别和子类别
在这个网站上:我使用了一个程序员来定制模板。他的本页代码为:Php 将帖子限制为特定类别和子类别,php,wordpress,categories,Php,Wordpress,Categories,在这个网站上:我使用了一个程序员来定制模板。他的本页代码为: <?php $args = array( 'numberposts' => 18, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date"); $postslist = get_posts( $args ); echo '<ul id="latest_stories">'; foreach ($pos
<?php
$args = array( 'numberposts' => 18, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
$postslist = get_posts( $args );
echo '<ul id="latest_stories">';
foreach ($postslist as $post) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
<span class="s_thumb"> <?php the_post_thumbnail( 'full' ); ?> </span>
<span class="s_title"> <?php the_title(); ?> </span></a>
<span class="s_cotegories">More Stories from <?php the_category( ', ' ); ?></span></li>
<?php endforeach; ?>
更多故事来自
这些帖子应该限制在一个特定的类别(#82)及其子类别内。我知道如何使用传统的post显示来实现这一点:但由于我没有编写这段代码,我不知道如何修改它。您可以在数组中设置过去的类别以获取帖子
$args = array( 'numberposts' => 18, 'post_status'=>"publish",'post_type'=>"post",
'orderby'=>"post_date", category=>82);
您可以将数组中的类别设置为“过去”,以获取\u帖子
$args = array( 'numberposts' => 18, 'post_status'=>"publish",'post_type'=>"post",
'orderby'=>"post_date", category=>82);