Skip to content

Commit

Permalink
Media: Change link text when attachment pages disabled.
Browse files Browse the repository at this point in the history
When attachment pages are disabled, change the links from "View Attachment Page" to "View Media File".

Follow-up to [56657], [56658].

Props joedolson, ironprogrammer, oglekler.
Fixes #57913.

git-svn-id: https://develop.svn.wordpress.org/trunk@56711 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
hellofromtonya committed Sep 26, 2023
1 parent ae1484c commit dc31cf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/wp-includes/media-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,10 @@ function wp_print_media_templates() {

<div class="actions">
<# if ( data.link ) { #>
<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
<?php
$view_media_text = ( '1' === get_option( 'wp_attachment_pages_enabled' ) ) ? __( 'View attachment page' ) : __( 'View media file' );
?>
<a class="view-attachment" href="{{ data.link }}"><?php echo $view_media_text; ?></a>
<# } #>
<# if ( data.can.save ) { #>
<# if ( data.link ) { #>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function create_initial_post_types() {
'name_admin_bar' => _x( 'Media', 'add new from admin bar' ),
'add_new' => __( 'Add New Media File' ),
'edit_item' => __( 'Edit Media' ),
'view_item' => __( 'View Attachment Page' ),
'view_item' => ( '1' === get_option( 'wp_attachment_pages_enabled' ) ) ? __( 'View Attachment Page' ) : __( 'View Media File' ),
'attributes' => __( 'Attachment Attributes' ),
),
'public' => true,
Expand Down

0 comments on commit dc31cf0

Please sign in to comment.