这个需求我觉得比较少,但是还是记录一下,指不定以后有这个需求呢
从网络上面了解到的有比较多的方法,但是我推荐下面这段代码,比较直接:
1 2 3 4 5 6 7 8 9 10 |
add_action('admin_footer', function() { ?> <script type="text/javascript"> jQuery(document).ready( function($) { _wpMediaViewsL10n.insertIntoPost = 'Gotchya!'; }); </script> <?php }); |
代码方面通过添加JS代码替换_wpMediaViewsL10n数组中的变量值,至于_wpMediaViewsL10n是干什么的:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script type='text/javascript'> /* <![CDATA[ */ var _wpMediaViewsL10n = { "url":"URL", "addMedia":"Add Media", "search":"Search", "select":"Select", "cancel":"Cancel", "selected":"%d selected", "dragInfo":"Drag and drop to reorder images.", "uploadFilesTitle":"Upload Files", "uploadImagesTitle":"Upload Images", "mediaLibraryTitle":"Media Library", "insertMediaTitle":"Insert Media", "createNewGallery":"Create a new gallery", "returnToLibrary":"\u2190 Return to library", "allMediaItems":"All media items", "noItemsFound":"No items found.", "insertIntoPost":"Insert into post", "uploadedToThisPost":"Uploaded to this post", // ET CETERA }; /* ]]> */ </script> |