我已经被这个问题困扰了很长时间了,我不确定该怎么办了。我试图用谷歌搜索问题,但解决方案(CSS和PHP)没有任何帮助。
任何人都可以帮助我从页面标题中仅删除“存档:”部分吗?
我正在使用“事件日历”插件。 https://wordpress.org/plugins/the-events-calendar/
谢谢!
答案 0 :(得分:0)
这实际上取决于您使用的主题。尝试从Archive.php页面中搜索标题函数。
快速修复!将此添加到您的CSS。
body.post-type-archive-tribe_events .page-title .col-md-12.page-title-container h1 { display: none !important; }
答案 1 :(得分:0)
请使用Yoast SEO插件。参考:https://en-gb.wordpress.org/plugins/wordpress-seo/
“事件日历”文档为您提供了full instruction有关如何执行您的要求的信息。
在子主题 functions.php 文件中安装一个WordPress子主题,将其粘贴:
// Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)
add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 );
function tribe_remove_wpseo_title_rewrite() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
$wpseo_front = WPSEO_Frontend::get_instance();
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 );
}
} elseif ( class_exists( 'Tribe__Events__Main' ) && !class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
$wpseo_front = WPSEO_Frontend::get_instance();
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 );
}
}
};