2013-04-16 88 views
0

我使用WordPress的公司網站,但我想完全刪除評論功能,所以不僅僅是通過取消選中每個頁面中的「alow評論」。刪除wordpress內的評論功能

我做了一些googeling並說我應該刪除此行代碼:

<?php comments_template(); // Get wp-comments.php template ?> 

而且這段代碼也應位於page.php文件,但我無法找到該代碼。 也許這是一種在老版本的WordPress中做到這一點的方法?

是否知道我可以如何移除它? :)

+0

你正在使用哪個主題? – oscprofessionals

+0

OlevMedia – Tapy

+0

一個叫做MetroStyle的主題是否嘗試搜索所有文件中的「comments_template();」 – oscprofessionals

回答

0

你必須刪除<?php comments_template(); ?>在你的模板中的所有content*.php和所有if (comments_open()) .. endif

0

之間。因爲你無法找到comments_template();在你的頁面模板,檢查該網頁使用內容模板中。

get_template_part功能會是這個樣子:

<?php get_template_part('content', 'single'); ?> 

用破折號加入這兩個參數,並檢查該模板內(在上述情況下,你會檢查內容的single.php)。

如果您仍然無法找到comments_template();,也許您的網頁確實是帖子,那麼請在Single Post模板(single.php)中查找該評論功能並找到其內容模板(與我們對頁面所做的相同方式)。