admin管理员组文章数量:1130349
I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.
Please help. Thank you!
I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.
Please help. Thank you!
Share Improve this question asked Nov 12, 2018 at 11:29 Syamsul AlamSyamsul Alam 11 silver badge6 bronze badges 4 |2 Answers
Reset to default 0You can add the following function in the functions.php of your child theme.
add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
return $title;
}
Basically I'm adding this code in my theme's / child theme's function.php
add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $title ) {
return '';
};
And voilà it's gone, completely, forever!! Just the way I want it!
I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.
Please help. Thank you!
I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.
Please help. Thank you!
Share Improve this question asked Nov 12, 2018 at 11:29 Syamsul AlamSyamsul Alam 11 silver badge6 bronze badges 4-
So the page should render as
<title></title>? – kero Commented Nov 12, 2018 at 11:32 - You need to remove it from the template, that's it. – Jacob Peattie Commented Nov 12, 2018 at 11:40
-
@kero if i remove it, are my title tag gonna be empty? I just want to remove the
<h1>Archive: Bla3</h1>not removing the title tag, is it possible? – Syamsul Alam Commented Nov 13, 2018 at 3:17 - @JacobPeattie can you please elaborate in answer, i'm not familiar with removing it from template.. thank you mate. :D – Syamsul Alam Commented Nov 13, 2018 at 3:30
2 Answers
Reset to default 0You can add the following function in the functions.php of your child theme.
add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
return $title;
}
Basically I'm adding this code in my theme's / child theme's function.php
add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $title ) {
return '';
};
And voilà it's gone, completely, forever!! Just the way I want it!
本文标签: How to Completely Remove Archive Title aka thearchivetitle
版权声明:本文标题:How to Completely Remove Archive Title a.k.a the_archive_title? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749182546a2328850.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


<title></title>? – kero Commented Nov 12, 2018 at 11:32<h1>Archive: Bla3</h1>not removing the title tag, is it possible? – Syamsul Alam Commented Nov 13, 2018 at 3:17