post thumbnails - How to add custom label or texts in featured image

admin2025-01-07  3

I have tried to add custom title or hint text inside the featured image box in Worpress custom taxonomy. but didn't get the solution. how to add a custom text underneath of the Click the image to edit or update in featured image.

Please check the screenshot for better understanding.

Thanks

I have tried to add custom title or hint text inside the featured image box in Worpress custom taxonomy. but didn't get the solution. how to add a custom text underneath of the Click the image to edit or update in featured image.

Please check the screenshot for better understanding.

https://www.screencast.com/t/VafpoWvxw

Thanks

Share Improve this question edited Mar 18, 2018 at 19:39 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Mar 18, 2018 at 18:58 abuabu 612 silver badges6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can do this by calling a javascript file for admin.

Create a javascript file in js folder in you current theme called admin.js. inside the file add this code:

jQuery(document).ready(function($) {
    $('#postimagediv .inside').prepend('<p>Recommended image size 300*300px</p>');
});

Now in functions.php in your current theme folder add this code to call the javascript file exclusive for admin backend.

add_action('admin_init', 'custom_admin_js');
function custom_admin_js() {
    wp_register_script( 'admin-js', get_stylesheet_directory_uri() . '/js/admin.js' );
    wp_enqueue_script( 'admin-js' );
}

For different taxonomy blocks/sections you can use their identifier and in html their ID will end with div. For example if the taxonomy identifier is "some_taxonomy_identifier" the html ID will be "some_taxonomy_identifierdiv". so in js will be like this:

$('#some_taxonomy_identifierdiv .inside').prepend('<p>Some recommended text</p>');
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256656a379.html

最新回复(0)