Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

RSS Latest posts from my personal blog


Most viewed posts


Subscribe to RSS feed


Always display image edit and remove buttons in Advanced Custom Fields

Stanislav KhromovStanislav Khromov

I had an annoying usability problem with Advanced Custom Fields. Users of the system did not understand how to change or remove an already uploaded image, because the buttons to do so only show up after the user has hovered over the existing image, like this:

always-display-these

Here is a little snippet that you can add to your functions.php file in your theme to always display these buttons in the admin.

add_action('admin_footer', function()
{
    ?>
    <style type="text/css">
        .acf-image-uploader .hover
        {
            visibility: visible;
            opacity: 1;
        }
    </style>
    <?php
}, 999);

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 1
  • sujata
    Posted on

    sujata sujata

    Reply Author

    How to add these buttons without using ACF? without using plugin i want to add these buttons in my custom fields. How to do that?