我有一個與Remove_filter()的問題。刪除過濾器的作品,但不是100%,它不會刪除第一個3點從閱讀更多,它不會取代父節選。Wordpress刪除閱讀更多摘錄
更明確地說什麼,我試圖做的是去除更多並將其轉換爲[...]。
我想這是從兒童主題完成。
父主題的functions.php代碼
function new_excerpt_more($more) {
global $post;
return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More! »' . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
兒童主題的functions.php代碼。
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter('excerpt_more', 'new_excerpt_more');
}
add_action('after_setup_theme', 'child_theme_setup');
// Replaces the excerpt "Read More" text by a link
function new_excerpt($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '">[...] </a>';
}
add_filter('excerpt', 'new_excerpt');
明確指出你的問題。 –
@HappyCoding,我編輯它 –