[英]WordPress “wp_list_comments” custom order
我正在使用WordPress 3.0.1,並希望使用評級自定義字段從帖子中訂購評論。
這可能嗎? 我已經在使用wp_list_comments的callback屬性來自定義注釋的外觀。
不幸的是,這樣我只能一個接一個地訪問注釋,而不會影響所有結果數組的順序。
我已經有一張桌子,上面有用戶的所有投票。
提前致謝。
// get comments of post 1234
$comments = get_comments( array('post_id' => 1234) );
// ... order your comments collection using php (eg. usort) here ...
// print your comments
wp_list_comments( array( 'callback' => 'woocommerce_comments' ), $comments);
嘗試$comments = get_comments('postId=x');
。 它應該通過評論ID索引。 然后,您可以在表格中查找評論評分。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.