wordpress調用評論標籤comments_template的方法

comments_template標籤是方便我們在wordpress網站中調用評論文件comments.php的,如果在主題當中沒有comments.php文件,標籤會自動獲取程序路徑wp-includes/theme-compat/comments.php的默認評論模塊,在模板製作中我們使用以下標籤進行調用:

<?php comments_template( $file, $separate_comments ); ?>

其中的$file參數是指可以導入不同的評論文件的,例如:我們在主題中創建一個 comments-other.php 文件,我們可以通過以下代碼進行調用:

<?php comments_template( '/comments-other.php' ); ?>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章