Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1130349
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm new in wordpress. I am using one custom theme and install in wordpress.
I want to change category page title and remove "Category:" prefix from title. How can I manage it from admin ?
I don't know wordpress programming. So, I need to setup using admin panel.
Please guide me. Thanks !!
Page URL : http://localhost/tutorialsite/category/magento/magento-2/
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm new in wordpress. I am using one custom theme and install in wordpress.
I want to change category page title and remove "Category:" prefix from title. How can I manage it from admin ?
I don't know wordpress programming. So, I need to setup using admin panel.
Please guide me. Thanks !!
Page URL : http://localhost/tutorialsite/category/magento/magento-2/
Share Improve this question edited Nov 12, 2018 at 17:01 Rohan Hapani asked Nov 12, 2018 at 16:53 Rohan HapaniRohan Hapani 1035 bronze badges 4- 1 Possible duplicate of Remove "Category:", "Tag:", "Author:" from the_archive_title – kero Commented Nov 12, 2018 at 16:57
- It's programmatically. I don't know programming of wordpress. I need to setup from admin. – Rohan Hapani Commented Nov 12, 2018 at 16:59
- @kero can you please help me how to solve it? I'm totally new in wordpress. – Rohan Hapani Commented Nov 12, 2018 at 17:04
- This is a programming community here (mostly). If you don't want to use custom code, I think yoast plugin can do this for you – kero Commented Nov 12, 2018 at 17:09
1 Answer
Reset to default 1In your functions.php of your theme file add the following code, taken from Remove "Category:", "Tag:", "Author:" from the_archive_title.
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
//being a category your new title should go here
$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;
});
Of course you need to read about how the functions.php works. https://codex.wordpress/Functions_File_Explained
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm new in wordpress. I am using one custom theme and install in wordpress.
I want to change category page title and remove "Category:" prefix from title. How can I manage it from admin ?
I don't know wordpress programming. So, I need to setup using admin panel.
Please guide me. Thanks !!
Page URL : http://localhost/tutorialsite/category/magento/magento-2/
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm new in wordpress. I am using one custom theme and install in wordpress.
I want to change category page title and remove "Category:" prefix from title. How can I manage it from admin ?
I don't know wordpress programming. So, I need to setup using admin panel.
Please guide me. Thanks !!
Page URL : http://localhost/tutorialsite/category/magento/magento-2/
Share Improve this question edited Nov 12, 2018 at 17:01 Rohan Hapani asked Nov 12, 2018 at 16:53 Rohan HapaniRohan Hapani 1035 bronze badges 4- 1 Possible duplicate of Remove "Category:", "Tag:", "Author:" from the_archive_title – kero Commented Nov 12, 2018 at 16:57
- It's programmatically. I don't know programming of wordpress. I need to setup from admin. – Rohan Hapani Commented Nov 12, 2018 at 16:59
- @kero can you please help me how to solve it? I'm totally new in wordpress. – Rohan Hapani Commented Nov 12, 2018 at 17:04
- This is a programming community here (mostly). If you don't want to use custom code, I think yoast plugin can do this for you – kero Commented Nov 12, 2018 at 17:09
1 Answer
Reset to default 1In your functions.php of your theme file add the following code, taken from Remove "Category:", "Tag:", "Author:" from the_archive_title.
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
//being a category your new title should go here
$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;
});
Of course you need to read about how the functions.php works. https://codex.wordpress/Functions_File_Explained
本文标签: categoriesSet category page title in custom theme
版权声明:本文标题:categories - Set category page title in custom theme 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749188674a2329819.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论