一般評(píng)論列表顯示在文章頁面中。
使用 wp_list_comments 函數(shù)即可。
若沒有參數(shù),則輸出默認(rèn)的品論列表。
一般改函數(shù)寫在comments.php模板中。
<?php wp_list_comments(); ?>
wp_list_comments的第一個(gè)參數(shù)可以用于列表的自定義:
style 可以選擇 div ul ol 標(biāo)簽包圍評(píng)論列表
max_depth 返回樹形結(jié)構(gòu)的最大深度
type 輸出評(píng)論類型:all comment trackback pingback pings
per_page 每頁輸出的評(píng)論數(shù)。
format html5 或者 xhtml
avatar_size Gravatar頭像尺寸
reverse_top_level true則按照時(shí)間降序排序
若要每頁顯示10條評(píng)論并按時(shí)間降序排列,
分頁的上下頁鏈接需要使用 previous_comment_link/next_comments_link輸出,將在今后講解。
- wp_list_comments(array(
- 'reverse_top_level' => false,
- 'per_page' => 10
- ));
新聞熱點(diǎn)
疑難解答
圖片精選