<?php query_posts( \'cat=16\'); ?>
<?php if ( have_posts() )
while ( have_posts() ) : the_post(); ?>
<?php print_custom_field(\'time\'); ?>
<?php the_title(); ?>
<?php endwhile;?>
这是我的查询,我希望帖子按ASC中的自定义字段“时间”排序Post order by custom fields
1 个回复
SO网友:Rarst
这可能是这样的:
query_posts( array(
\'cat\' => \'16\',
\'order\' => \'ASC\',
\'orderby\' => \'meta_value\',
\'meta_key\' => \'time\',
) );
请参见WP_Query
有关更多信息,请参阅Codex中的文档。结束