0

I was wondering if it was possible that the "Expand Details" option via "Add Media" can be renamed? I couldn't find a guide online so I thought I would ask here for guidance, (that's if it's possible).

Many thanks.

  • What do you want to rename it to? – jgraup Jan 24 '16 at 3:30
  • @jgraup Title and Description – Gareth Bolton Jan 24 '16 at 19:06
0

It's possible to change the output of the label with jQuery but I'm not sure the best hook to do this besides admin_footer.

// Collapse

var $open = jQuery('.acf-expand-details > .is-open'), 
    $open_icon = $open.find('span');

$open.html('MIN Details -->');
$open.prepend($open_icon);

// Expand

var $close = jQuery('.acf-expand-details > .is-closed'),
    $close_icon = $close.find('span');

$close.html('<-- MAX Details');
$close.prepend($close_icon);

add_action( 'admin_enqueue_scripts', 'admin_enqueue_scripts_replace_test', 10 );

function admin_enqueue_scripts_replace_test() {
    wp_enqueue_script( 'jquery' );
    add_action( 'admin_footer', 'admin_footer_replace_test', 10 );
}

function admin_footer_replace_test() {
    ?>
    <script>
        jQuery(document).ready(function () {
            // target frame
        });
    </script>
    <?php
}

You might have to read up on wp.media and take a look at WP Media Javascript Guide for detecting frame events.

  • Hey thanks! So do I put the top piece of code in my admin footer( how do I do that sorry?) and the bottom piece in my functions.php? – Gareth Bolton Jan 25 '16 at 7:15
  • It doesn't work, sorry. But that information might get you closer to what you need. You'll need to figure out how to detect when the frame is ready and when you can get access via jQuery. Once you have that, the replace code works fine. – jgraup Jan 25 '16 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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