content-audio.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Template part for displaying posts with the audio format.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Scratchpad
  8. */
  9. $content = apply_filters( 'the_content', get_the_content() );
  10. ?>
  11. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  12. <?php scratchpad_sticky(); ?>
  13. <?php
  14. $audio = get_media_embedded_in_content( $content, array( 'audio' ) );
  15. if ( ! empty( $audio ) ) {
  16. foreach ( $audio as $audio_html ) {
  17. $content = str_replace( $audio_html, '', $content );
  18. ?>
  19. <div class="entry-audio">
  20. <?php echo $audio_html; ?>
  21. </div><!-- .entry-audio -->
  22. <?php
  23. break;
  24. } //foreach
  25. } // endif !empty ( $media )
  26. ?>
  27. <header class="entry-header">
  28. <?php
  29. the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
  30. ?>
  31. <div class="entry-meta">
  32. <?php scratchpad_post_format(); ?>
  33. <?php scratchpad_posted_on(); ?>
  34. <?php
  35. edit_post_link(
  36. sprintf(
  37. /* translators: %s: Name of current post */
  38. esc_html__( 'Edit %s', 'scratchpad' ),
  39. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  40. ),
  41. '<span class="edit-link"><span class="sep">&bull;</span>',
  42. '</span>'
  43. );
  44. ?>
  45. </div><!-- .entry-meta -->
  46. </header><!-- .entry-header -->
  47. <?php if ( post_password_required() ) {
  48. the_content();
  49. } ?>
  50. </article><!-- #post-## -->