php PHP为每位作者的WP总帖子提供支持

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php PHP为每位作者的WP总帖子提供支持相关的知识,希望对你有一定的参考价值。

<?php
function sort_objects_by_total($a, $b) {
	if($a->total_posts == $b->total_posts){ return 0 ; }
	return ($a->total_posts < $b->total_posts) ? -1 : 1;
}

// The function returns -1 (smaller than), 0 (equal to), or 1 (larger than) 
// when doing the sort comparisons.  The last is applying the sortation 
// function to the array, which is done by usort:
usort($users, 'sort_objects_by_total');

以上是关于php PHP为每位作者的WP总帖子提供支持的主要内容,如果未能解决你的问题,请参考以下文章