admin管理员组文章数量:1130349
I'm tyring to change the "View all posts in category" tooltip you see when you hover over a category link in wordpress. Until now I've always done it in the Wordpress core file named category-template.php - however I'm searching for a method to do it in the functions.php so I don't have to change it after every Wordpress update.
I could only find this code to remove the "View all posts in category" title attribute alltogether, but I have no idea how to modify it:
add_filter( 'the_category', 'remove_category_title' );
function remove_category_title( $category ) {
return preg_replace( '/\s* title=\s*".*?"/i', '', $category );
}
I just want to change the text "View all posts in" and "View all posts filed under"
I'm tyring to change the "View all posts in category" tooltip you see when you hover over a category link in wordpress. Until now I've always done it in the Wordpress core file named category-template.php - however I'm searching for a method to do it in the functions.php so I don't have to change it after every Wordpress update.
I could only find this code to remove the "View all posts in category" title attribute alltogether, but I have no idea how to modify it:
add_filter( 'the_category', 'remove_category_title' );
function remove_category_title( $category ) {
return preg_replace( '/\s* title=\s*".*?"/i', '', $category );
}
I just want to change the text "View all posts in" and "View all posts filed under"
Share Improve this question edited Apr 26, 2014 at 20:56 ndru asked Apr 26, 2014 at 20:43 ndrundru 1593 silver badges13 bronze badges 2 |1 Answer
Reset to default 1Found something that works fine:
add_filter( 'the_category', 'remove_category_link_prefix' );
add_filter( 'wp_list_categories', 'remove_category_link_prefix' );
function remove_category_link_prefix($output) {
$replace = array(
'View all posts in',
'View all posts filed under'
);
return str_replace( $replace, 'Text you want to show up', $output);
}
found here: http://kaspars/blog/wordpress/remove-view-all-posts-filed-under-category-widget
I'm tyring to change the "View all posts in category" tooltip you see when you hover over a category link in wordpress. Until now I've always done it in the Wordpress core file named category-template.php - however I'm searching for a method to do it in the functions.php so I don't have to change it after every Wordpress update.
I could only find this code to remove the "View all posts in category" title attribute alltogether, but I have no idea how to modify it:
add_filter( 'the_category', 'remove_category_title' );
function remove_category_title( $category ) {
return preg_replace( '/\s* title=\s*".*?"/i', '', $category );
}
I just want to change the text "View all posts in" and "View all posts filed under"
I'm tyring to change the "View all posts in category" tooltip you see when you hover over a category link in wordpress. Until now I've always done it in the Wordpress core file named category-template.php - however I'm searching for a method to do it in the functions.php so I don't have to change it after every Wordpress update.
I could only find this code to remove the "View all posts in category" title attribute alltogether, but I have no idea how to modify it:
add_filter( 'the_category', 'remove_category_title' );
function remove_category_title( $category ) {
return preg_replace( '/\s* title=\s*".*?"/i', '', $category );
}
I just want to change the text "View all posts in" and "View all posts filed under"
Share Improve this question edited Apr 26, 2014 at 20:56 ndru asked Apr 26, 2014 at 20:43 ndrundru 1593 silver badges13 bronze badges 2- There are multiple instances of this string in WordPress core. Which function exactly are you asking about? – Rarst Commented Apr 26, 2014 at 20:49
-
ideally every instance of "View all posts in" and "View posts filed under" in the core file category-template.php. In line 59 for example
$chain .= '<a href="' . esc_url( get_category_link( $parent->term_id ) ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $parent->name ) ) . '">'.$name.'</a>' . $separator;– ndru Commented Apr 26, 2014 at 21:02
1 Answer
Reset to default 1Found something that works fine:
add_filter( 'the_category', 'remove_category_link_prefix' );
add_filter( 'wp_list_categories', 'remove_category_link_prefix' );
function remove_category_link_prefix($output) {
$replace = array(
'View all posts in',
'View all posts filed under'
);
return str_replace( $replace, 'Text you want to show up', $output);
}
found here: http://kaspars/blog/wordpress/remove-view-all-posts-filed-under-category-widget
本文标签: categoriesHow to modify the quotView all posts in categoryquot title attribute
版权声明:本文标题:categories - How to modify the "View all posts in category" title attribute 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749072670a2311821.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


$chain .= '<a href="' . esc_url( get_category_link( $parent->term_id ) ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $parent->name ) ) . '">'.$name.'</a>' . $separator;– ndru Commented Apr 26, 2014 at 21:02