0
A
回答
3
你使用的WP版本是什麼?
在WP 3+(也許更早)你只是去到儀表板,單擊頁,單擊編輯有問題的頁面,向下滾動到討論的部分,並取消允許評論&允許引用通告&包括引用盒。然後垃圾附加到頁面的任何評論。
如果你實際上意味着後而不是頁,那麼保羅就是在正確的一個小修改的主題將是必要的。注意:只要有可能,請使用兒童主題來做到這一點,這樣您就不會不小心敲擊主題。
假設您使用的是WP 3和默認的Twenty Ten主題,請編輯wp-content/themes/twentyten/comments.php(或創建一個子主題,複製comments.php,然後繼續)。
的comments.php,行70,上寫着:
if (! comments_open()) :
更改它讀取:
if (0 && ! comments_open()) :
這有效地殺滅線後,這也正是 「評論被關閉」 輸出,但沒有完全刪除它。很明顯,如果你使用的是不同的主題,你必須在自己的comments.php中搜索相應的行。
請注意,這是一個快速和骯髒的黑客將影響所有職位。如果您只想爲選定的帖子執行此操作,您必須做更多的工作。
0
您需要編輯顯示出模板外的行。
0
最簡單的方法是找到theme/page.php中的以下行並刪除或註釋它。
<?php comments_template('', true); ?>
1
轉到Wordpress頁面 - 單擊「快速編輯」,您將看到選項給予註釋的刻度標記,可以避免該刻度標記。
yourdomainname.com /wp-admin/edit.php?post_type=page
然後每個頁面的
點擊快速編輯。
3
將此代碼添加到您的function.php文件
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
}
add_action('admin_init', 'df_disable_comments_post_types_support');
// Close comments on the front-end
function df_disable_comments_status() {
return false;
}
add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);
// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);
// Remove comments page in menu
function df_disable_comments_admin_menu() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'df_disable_comments_admin_menu');
// Redirect any user trying to access comments page
function df_disable_comments_admin_menu_redirect() {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
}
add_action('admin_init', 'df_disable_comments_admin_menu_redirect');
// Remove comments metabox from dashboard
function df_disable_comments_dashboard() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'df_disable_comments_dashboard');
// Remove comments links from admin bar
function df_disable_comments_admin_bar() {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
}
add_action('init', 'df_disable_comments_admin_bar');
0
您可以編輯頁面模板。尋找get_template_part('comments')
並刪除它
相關問題
- 1. 如何在生成的HTML頁面中隱藏JavaScript註釋?
- 2. 隱藏WordPress頁面標題
- 3. 如何在瀏覽器視圖頁面源中隱藏或刪除註釋?
- 4. 如何在Wordpress中向靜態頁面顯示註釋
- 5. Wordpress隱藏儀表板中的頁面
- 6. 如何在wordpress中的特定頁面上隱藏標題
- 7. 如何在一個wordpress頁面中隱藏導航菜單?
- 8. 如何在woocommerce頁面中隱藏默認WordPress的側邊欄?
- 9. 我如何隱藏使用tableView註釋
- 10. 在散景中隱藏註釋
- 11. 如何隱藏頁面
- 12. WordPress - 如何創建隱藏的管理面板頁面?
- 13. 如何隱藏WordPress中的菜單頁面?
- 14. 如何隱藏完整的DataGrid行?
- 15. 如何隱藏完整音量?
- 16. (tumblr)如果在帖子中沒有註釋,如何隱藏{NoteCount}?
- 17. 如何在wordpress中隱藏未登錄用戶的完整內容?
- 18. 如何隱藏成功頁面在Django
- 19. 如何在chrome開發工具中隱藏html註釋?
- 20. 如何隱藏Wordpress中特定頁面的菜單中的首頁?
- 21. 隱藏MP3完整URL
- 22. Wicket:隱藏HTML中的註釋
- 23. Excel註釋在單元格下隱藏
- 24. 我們如何才能隱藏一些頁面WordPress的登錄?
- 25. 如何從WordPress管理端隱藏頁面
- 26. 如何隱藏我的WordPress站點頁面源碼(bczcentral.com)?
- 27. 隱藏的數據註釋不會隱藏EditorFor()中的字段?
- 28. 如何在wordpress中創建動態頁面並從菜單中隱藏
- 29. WordPress的 - 隱藏子頁面的兒童在wp_list頁
- 30. 如何在WordPress中隱藏模板?
可能是superuser.com的情況。 – mnuzzo 2010-10-12 18:59:47