3 simple script to manage the WordPress admin
Adding a caption for the post thumbnail
Everything is simple, if you need to leave a comment for your moderators, then this can be done using the code for inserting text into the metabox of the thumbnail right below it.
1 2 3 4 |
add_filter( 'admin_post_thumbnail_html', 'add_featured_image_html'); function add_featured_image_html( $html ) { return $html .= '<p>Миниатюра записи это маленькая картинка, которая добавляется администратором и обычно отображается в начале поста.</p>'; } |
By adding code, you will get a signature under the thumbnail block in the admin panel.
Adding a Gravatar.
We optimize the admin panel to increase the loyalty of site users. Instead of favicon your site, which the user saw during the search and during registration, show him his own gravatar. In addition, the avatar from the gravatar will be displayed in the user profile.
1 2 3 4 5 6 7 8 9 10 |
function gravatar_favicon() { $GetTheHash = md5(strtolower(trim(get_bloginfo('admin_email')))); return 'https://www.gravatar.com/avatar/' . $GetTheHash . '?s=16'; } function favicon() { if ( is_user_logged_in() ) { echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.gravatar_favicon().'" />'; } } add_action('wp_head', 'favicon'); |
Changing the default text in the admin panel. When entering a title.
Another useful code for those, who wants to remake the WordPress admin area for themselves.
1 2 3 4 |
function title_text_input( $title ){ return $title = 'Enter new title'; } add_filter( 'enter_title_here', 'title_text_input' ); |
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.