How to replace “Password Protected” text with icon in Admin
Pergunta
In Wordpress, whenever a post is password protected the backend admin area appends the text in bold "- Password protected" after the post title.
What I am looking for is a way to remove this text and instead have it utilize an icon (link below) which should be appended before the title text.
How can this be done?
I want to use an Icon from the Aesthetica Icon Set by http://dryicons.com:
Solução
Try this (don't forget to replace icon URL):
add_filter( 'display_post_states', 'password_protected_icon' );
function password_protected_icon( $post_states ) {
$text = __('Password protected');
$pos = array_search( $text, $post_states);
if( false !== $pos )
$post_states[$pos] = '<img src="http://i.stack.imgur.com/aIDa6.png" title="'.htmlspecialchars($text).'"/>';
return $post_states;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange