开发者

Rookie PHP question sorting result of custom field

I use this to pull values from a custom field with several values:

<?php  $mykey_values = get_post_custom_values('services');
    foreach ( $mykey_values as $key => $val开发者_C百科ue ) {
    echo "<li> $value</li>";
    } ?>

I want to sort the output according to the way I have set up the values in the key (alphabetically)


$mykey_values = get_post_custom_values('services');
sort($mykey_values, SORT_STRING);
echo "<ul>\n<li>" . implode('</li><li>', $mykey_values) . "</li>\n</ul>";

Documentation for get_post_custom_values() and sort().


You could use the sort() function. See it's documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜