• seito

    (@seito)


    Hi,

    I’m reading through codex and developer resources but can’t seem to find the correct hook or a way to achieve desired effect.

    What I wish to have is an icon button overlying a corner of each image thumbnail in grid and list view in the admin->media->library.

    I reckon I should hook in some process that reads and then displays thumbs of all files in media library and add my code for button to it. But can’t seem to find a clear documentation which process that is and what filter to use to hook it.

    Any guidance or suggestion what to do or where to look?

    Thank you!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The class responsible for the media library list output is declared in wp-admin/includes/class-wp-media-list-table.php. The grid view is achieved with jQuery, I’m not familiar with this aspect, but try looking at wp-includes/js/media-grid.js

    For the list view, I’m not aware of any hook that will easily let you do what you want. The class method that outputs each thumbnail (plus title and filename) is column_title() (line 357). Give it a look, maybe you’ll see some way to add something in, but I don’t. It is possible to remove the default File column and add in your own version, but doing so gets pretty involved. I think there’s a better way,

    I suspect your best bet in both cases would be to use jQuery to identify all thumbnails on the page and insert an overlaid icon to each thumb’s container. As long as you get your script to run after any other display scripts are finished, it should do the job.

Viewing 1 replies (of 1 total)
  • The topic ‘Media library buttons’ is closed to new replies.