有人能帮我把这个自定义帖子类型分成两个列表吗?我是一个PHPr新手,但有人告诉我这段代码太复杂了。。。
function listforcontinent($name, $top = false){
// top=true - show name, no columns
// top=false - dont show name, columns
$slugname = sanitize_title($name);
$args = array(\'tax_query\' => array(array(
\'taxonomy\' => \'jurisdiction_continents\',
\'field\' => \'slug\',
\'terms\' => $slugname)),
\'post_type\' => \'jurisdiction\',
\'orderby\' => \'title\',
\'posts_per_page\' => 35,
\'order\' => \'ASC\');
$postslist = get_posts( $args );
if ($postslist) {
if($top) echo \'<h4>\'.$name.\'</h4>\';
echo \'<ul>\';
foreach ( $postslist as $post ) {
setup_postdata($post);
echo \'<li><a href="\'.get_permalink($post->ID).\'">\'.get_the_title($post->ID)."</a></li>";
}
echo \'</ul>\';
}else{
if($top) echo \'<h4>\'.$name.\'</h4>\';
}
}
非常感谢您的帮助,谢谢:)