【发布时间】:2017-07-13 09:51:35
【问题描述】:
我有未排序的目的地,我按以下方式打印:
$destinations = get_posts( array(
'post_type' => 'destination_showcase',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'destination_state',
'value' => ':"'.$state_id . '";' , // looking for serialized value in quotes
'compare' => 'LIKE'
)
),
) );
我想按字母顺序打印目的地。当我对#destinations 数组进行 var_dump 编辑时,我得到了所有目的地及其参数。我想得到他们的标题,即“post_title”并按字母顺序打印。这个我试过了,还是不行:
'orderby'=> $destinations->post_title, 'order' => 'ASC',
有什么想法可以完成这项任务吗?
【问题讨论】:
-
不应该是
'orderby'=> 'post_title'吗?
标签: php wordpress alphabetical