您好我想更改媒体弹出窗口中的一些字符串我发现我可以过滤$ strings可变宽度media_view_strings过滤器,我该怎么做?
我想改变
这是wp-includes / media.php文件
$strings = array(
// Generic
'url' => __( 'URL' ),
'addMedia' => __( 'Add Media' ),
'search' => __( 'Search' ),
'select' => __( 'Select' ),
'cancel' => __( 'Cancel' ),
'update' => __( 'Update' ),
'replace' => __( 'Replace' ),
'remove' => __( 'Remove' ),
'back' => __( 'Back' ),
/* translators: This is a would-be plural string used in the media manager.
If there is not a word you can use in your language to avoid issues with the
lack of plural support here, turn it into "selected: %d" then translate it.
*/
'selected' => __( '%d selected' ),
'dragInfo' => __( 'Drag and drop to reorder media files.' ),
// Upload
'uploadFilesTitle' => __( 'Upload Files' ),
'uploadImagesTitle' => __( 'Upload Images' ),
// Library
'mediaLibraryTitle' => __( 'Media Library' ),
'insertMediaTitle' => __( 'Insert Media' ),
'createNewGallery' => __( 'Create a new gallery' ),
'createNewPlaylist' => __( 'Create a new playlist' ),
'createNewVideoPlaylist' => __( 'Create a new video playlist' ),
'returnToLibrary' => __( '← Return to library' ),
'allMediaItems' => __( 'All media items' ),
'allDates' => __( 'All dates' ),
'noItemsFound' => __( 'No items found.' ),
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
'unattached' => __( 'Unattached' ),
'trash' => _x( 'Trash', 'noun' ),
'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkTrash' => __( "You are about to trash these items.\n 'Cancel' to stop, 'OK' to delete." ),
'bulkSelect' => __( 'Bulk Select' ),
'cancelSelection' => __( 'Cancel Selection' ),
'trashSelected' => __( 'Trash Selected' ),
'untrashSelected' => __( 'Untrash Selected' ),
'deleteSelected' => __( 'Delete Selected' ),
'deletePermanently' => __( 'Delete Permanently' ),
'apply' => __( 'Apply' ),
'filterByDate' => __( 'Filter by date' ),
'filterByType' => __( 'Filter by type' ),
'searchMediaLabel' => __( 'Search Media' ),
'noMedia' => __( 'No media attachments found.' ),
// Library Details
'attachmentDetails' => __( 'Attachment Details' ),
// From URL
'insertFromUrlTitle' => __( 'Insert from URL' ),
// Featured Images
'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
'setFeaturedImage' => $post_type_object->labels->set_featured_image,
// Gallery
'createGalleryTitle' => __( 'Create Gallery' ),
'editGalleryTitle' => __( 'Edit Gallery' ),
'cancelGalleryTitle' => __( '← Cancel Gallery' ),
'insertGallery' => __( 'Insert gallery' ),
'updateGallery' => __( 'Update gallery' ),
'addToGallery' => __( 'Add to gallery' ),
'addToGalleryTitle' => __( 'Add to Gallery' ),
'reverseOrder' => __( 'Reverse order' ),
// Edit Image
'imageDetailsTitle' => __( 'Image Details' ),
'imageReplaceTitle' => __( 'Replace Image' ),
'imageDetailsCancel' => __( 'Cancel Edit' ),
'editImage' => __( 'Edit Image' ),
// Crop Image
'chooseImage' => __( 'Choose Image' ),
'selectAndCrop' => __( 'Select and Crop' ),
'skipCropping' => __( 'Skip Cropping' ),
'cropImage' => __( 'Crop Image' ),
'cropYourImage' => __( 'Crop your image' ),
'cropping' => __( 'Cropping…' ),
'suggestedDimensions' => __( 'Suggested image dimensions:' ),
'cropError' => __( 'There has been an error cropping your image.' ),
// Edit Audio
'audioDetailsTitle' => __( 'Audio Details' ),
'audioReplaceTitle' => __( 'Replace Audio' ),
'audioAddSourceTitle' => __( 'Add Audio Source' ),
'audioDetailsCancel' => __( 'Cancel Edit' ),
// Edit Video
'videoDetailsTitle' => __( 'Video Details' ),
'videoReplaceTitle' => __( 'Replace Video' ),
'videoAddSourceTitle' => __( 'Add Video Source' ),
'videoDetailsCancel' => __( 'Cancel Edit' ),
'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
'videoAddTrackTitle' => __( 'Add Subtitles' ),
// Playlist
'playlistDragInfo' => __( 'Drag and drop to reorder tracks.' ),
'createPlaylistTitle' => __( 'Create Audio Playlist' ),
'editPlaylistTitle' => __( 'Edit Audio Playlist' ),
'cancelPlaylistTitle' => __( '← Cancel Audio Playlist' ),
'insertPlaylist' => __( 'Insert audio playlist' ),
'updatePlaylist' => __( 'Update audio playlist' ),
'addToPlaylist' => __( 'Add to audio playlist' ),
'addToPlaylistTitle' => __( 'Add to Audio Playlist' ),
// Video Playlist
'videoPlaylistDragInfo' => __( 'Drag and drop to reorder videos.' ),
'createVideoPlaylistTitle' => __( 'Create Video Playlist' ),
'editVideoPlaylistTitle' => __( 'Edit Video Playlist' ),
'cancelVideoPlaylistTitle' => __( '← Cancel Video Playlist' ),
'insertVideoPlaylist' => __( 'Insert video playlist' ),
'updateVideoPlaylist' => __( 'Update video playlist' ),
'addToVideoPlaylist' => __( 'Add to video playlist' ),
'addToVideoPlaylistTitle' => __( 'Add to Video Playlist' ),
);
/**
* Filter the media view settings.
*
* @since 3.5.0
*
* @param array $settings List of media view settings.
* @param WP_Post $post Post object.
*/
$settings = apply_filters( 'media_view_settings', $settings, $post );
/**
* Filter the media view strings.
*
* @since 3.5.0
*
* @param array $strings List of media view strings.
* @param WP_Post $post Post object.
*/
$strings = apply_filters( 'media_view_strings', $strings, $post );
全部
答案 0 :(得分:1)
在插件中尝试以下代码:
function wdm_custom_media_view_strings( $strings ) {
/*
1. Copy and paste array $strings from media.php
2. Now here you can modify $strings as per requirement.
*/
//Do not forget to return $strings
return $strings;
}
add_filter('media_view_strings', 'wdm_custom_media_view_strings');
随意提出疑问。