1

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

1 Answer 1

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>');
3
  • Hi mysticalghoul, Thank you for your information. it's working good.
    – abu
    Commented Mar 19, 2018 at 14:35
  • but one question is how to show this type of text in different taxonomies. because i have more than one taxonomy and we need to set different hint messages like this. now the above code is showing in all taxonomies. I mean , each taxonomy have different featured image size. its possible? if yes, please let me know. Thanks
    – abu
    Commented Mar 19, 2018 at 14:42
  • @abu Check the updated answer. Commented Mar 20, 2018 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.