How to remove hardcoded characters?

I’m working on a WordPress theme for a website that makes heavy use of its default media player. In the process of styling its playlists, I found that a core file injects hardcoded characters that can’t be made invisible just by using CSS, so I’m a bit clueless about how to hide/remove them.

These characters are injected on 3 different places on each playlist entry:

those entries are numbered, but the container is a div instead of an ol, so using list-style-type: none is not possible;
they add curly quotes to the song title, but not by using :before and :after;
and they add an em dash before the artist name, also not by using the :before pseudo-class.

On wordpresswp-includesjsmedia.php there’s a function called wp_underscore_playlist_templates which declares the following 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>

Of course I could edit this core file, but I don’t want to do that. So what should I do? Add a filter on functions.php? Make a JS file?

Read more here:: How to remove hardcoded characters?

Leave a Reply

Your email address will not be published. Required fields are marked *