Title: wp_underscore_playlist_templates
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_underscore_playlist_templates()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#wp--skip-link--target)

Outputs the templates used by playlists.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#source)󠁿

    ```php
    function wp_underscore_playlist_templates() {
    	?>
    <script type="text/html" id="tmpl-wp-playlist-current-item">
    	<# if ( data.thumb && data.thumb.src ) { #>
    		<img src="{{ data.thumb.src }}" alt="" />
    	<# } #>
    	<div class="wp-playlist-caption">
    		<span class="wp-playlist-item-meta wp-playlist-item-title">
    			<# if ( data.meta.album || data.meta.artist ) { #>
    				<?php
    				/* translators: %s: Playlist item title. */
    				printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{ data.title }}' );
    				?>
    			<# } else { #>
    				{{ 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 { #>
    				<# if ( data.artists && data.meta.artist ) { #>
    					<span class="wp-playlist-item-title">
    						<?php
    						/* translators: %s: Playlist item title. */
    						printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{{ data.title }}}' );
    						?>
    					</span>
    					<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
    				<# } else { #>
    					<span class="wp-playlist-item-title">{{{ data.title }}}</span>
    				<# } #>
    			<# } #>
    		</a>
    		<# if ( data.meta.length_formatted ) { #>
    		<div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
    		<# } #>
    	</div>
    </script>
    	<?php
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/media.php#L2968)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L2968-L3015)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#related)󠁿

| Uses | Description | 
| [_x()](https://developer.wordpress.org/reference/functions/_x/)`wp-includes/l10n.php` |

Retrieves translated string with gettext context.

  |

| Used by | Description | 
| [wp_ajax_parse_media_shortcode()](https://developer.wordpress.org/reference/functions/wp_ajax_parse_media_shortcode/)`wp-admin/includes/ajax-actions.php` |  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_underscore_playlist_templates/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_underscore_playlist_templates%2F)
before being able to contribute a note or feedback.