Support » Fixing WordPress » Removing Quotations from song titles in audio player

  • Resolved NLeVasseur

    (@nlevasseur)


    I’d like to remove the quotation marks from song titles in the audio player.

    As it is now, the output is:

    1. “Song Title by Jon Doe, Ann Doe and Bill Doe”

    I would like to be able to add the quotes around the title only by making that addition via properties/details/song title. (Before the file is uploaded to WordPress.) The output would then be:

    1. “Song Title” by Jon Doe, Ann Doe and Bill Doe

    How can I do this?

    Thank you!

    Nancy

    • This topic was modified 2 years, 9 months ago by Steven Stern (sterndata). Reason: moved to "fixing", removed bogus link
Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you have a page with an example?
    Did you use any plugins (to upload or display it)?
    Are there quotes in the information shown in the Media Library?

    Thread Starter NLeVasseur

    (@nlevasseur)

    Hi Joy,
    I wish I could include a screen shot, but the site is still in development. The way I formatted the example title above is how they all look.

    No plugins were used.

    No quotes are shown in the media library. They are hard-coded in the media.php functions file on lines 1832 and 1847. Please see below. I could change the file, but it would be overwritten with the next WordPress update. I’d like to add some script to my child theme’s function.php file.

    There are two instances of: ‘“%s”’, the &#8220 and &#8221 are the quotes that need to go. There are two instance of this below.

    function wp_underscore_playlist_templates() {
    ?>
    <script type="text/html" id="tmpl-wp-playlist-current-item">
    	<# if ( data.image ) { #>
    	<img src="{{ data.thumb.src }}" alt="" />
    	<# } #>
    	<div class="wp-playlist-caption">
    		<span class="wp-playlist-item-meta wp-playlist-item-title"><?php
    			/* translators: playlist item title */
    			printf( _x( '“%s”', 'playlist item title' ), '{{ data.title }}' );
    		?></span>
    		<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
    		<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
    	</div>
    </script>
    <script type="text/html" id="tmpl-wp-playlist-item">
    	<div class="wp-playlist-item">
    		<a class="wp-playlist-caption" href="{{ data.src }}">
    			{{ data.index ? ( data.index + '. ' ) : '' }}
    			<# if ( data.caption ) { #>
    				{{ data.caption }}
    			<# } else { #>
    				<span class="wp-playlist-item-title"><?php
    					/* translators: playlist item title */
    					printf( _x( '“%s”', 'playlist item title' ), '{{{ data.title }}}' );
    				?></span>
    				<# if ( data.artists && data.meta.artist ) { #>
    				<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
    				<# } #>
    			<# } #>
    		</a>
    		<# if ( data.meta.length_formatted ) { #>
    		<div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
    		<# } #>
    	</div>
    </script>

    Hmm, yes, I see the quotes there. You could write a ticket to get this fixed (and fix it yourself even). Here’s Trac: https://core.trac.wordpress.org/

    Meanwhile, there are plugins that let you easily change the strings used, because it’s all run through translation filters. I’m not sure how to target these, since that same string could be used elsewhere also (and need the quotes. But that’s a low probability.
    https://wordpress.org/plugins/say-what/

    Thread Starter NLeVasseur

    (@nlevasseur)

    Hi Joy,
    Thanks so much for your followup emails. I was able to get the code from the great support team at Apex—where I got the theme for the website.

    I include it below (with their permission) in hopes others will find it useful.

    Thanks again!

    // Additional Functions
    // =============================================================================
    function no_quotes($translated) {
    $translated = str_ireplace(‘“%s”’, ‘%s’, $translated);

    return $translated;
    }
    add_filter(‘gettext_with_context’, ‘no_quotes’ );

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing Quotations from song titles in audio player’ is closed to new replies.