• Screen Shot Link

    Above is a link to the page I am trying to edit in the Admin View.
    I do not know how to add a row of text above “Edit Image” link on the right, in the red box I have made.

    I do not quite understand how WP is displaying the contents of the page with JS. I cannot find a hook or filter for editing this information. The closest to what I found was the action ‘print_media_templates’ under media-template.php.

    I just want to add a simple row with the attachment id number.

    Thanks again.

    • This topic was modified 6 years, 1 month ago by LouisIsMyDog.
    • This topic was modified 6 years, 1 month ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You could not find a PHP hook for this because there are none. The media library is generated from Backbone JS. There’s no need for filters because you can modify the DOM through JS/jQuery. Any data your JS may need from PHP can be passed to it by calling wp_localize_script() in PHP. Then you could do something like
    jQuery('.attachment-info .dimensions').append('<div class="att-ID">ID: '+ dataObj.attId + '</div>');
    Where dataObj is an object of PHP data passed with wp_localize_script().

    Thread Starter LouisIsMyDog

    (@louisismydog)

    I figured it out. Actually, there is an action that controls this. You just have to remove the current action attached to ‘print_media_templates’. Copy what wp has under print_media_templates.php as their backbone.js template and add your own template to your functions.php and rehook it to ‘print_media_templates’. Then it’s a done deal. Thanks for the replay though!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Editing Media Library Grid View => Attachment Details’ is closed to new replies.