content-audio.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Template part for displaying audio format posts.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Toujours
  8. */
  9. ?>
  10. <?php
  11. /* translators: %s: Name of current post */
  12. $content_text = sprintf(
  13. wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'toujours' ), array( 'span' => array( 'class' => array() ) ) ),
  14. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  15. );
  16. $content = apply_filters( 'the_content', get_the_content( $content_text ) );
  17. ?>
  18. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  19. <?php
  20. $audio = get_media_embedded_in_content( $content, array( 'audio' ) );
  21. if ( ! empty( $audio ) ) {
  22. foreach ( $audio as $audio_html ) {
  23. $content = str_replace( $audio_html, '', $content );
  24. ?>
  25. <div class="entry-audio">
  26. <?php echo $audio_html; ?>
  27. </div><!-- .entry-audio -->
  28. <?php } // endforeach
  29. } // endif !empty ( $media )
  30. ?>
  31. <header class="entry-header">
  32. <?php if ( is_sticky() && is_home() ) { ?>
  33. <span class="featured-post"><?php esc_html_e( 'Featured', 'toujours' ); ?></span>
  34. <?php } ?>
  35. <?php if ( ! is_single() ) {
  36. the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
  37. } else {
  38. the_title( '<h2 class="entry-title">', '</h2>' );
  39. } ?>
  40. <?php if ( 'post' === get_post_type() ) : ?>
  41. <div class="entry-meta">
  42. <?php
  43. toujours_posted_on();
  44. toujours_comment_link();
  45. ?>
  46. </div><!-- .entry-meta -->
  47. <?php endif; ?>
  48. </header><!-- .entry-header -->
  49. <?php if ( '' !== $post->post_content ) { ?>
  50. <div class="entry-content">
  51. <?php echo $content; ?>
  52. <?php
  53. wp_link_pages( array(
  54. 'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', 'toujours' ) . '</span>',
  55. 'after' => '</div>',
  56. 'pagelink' => '<span class="page-links-num">%</span>'
  57. ) );
  58. ?>
  59. </div><!-- .entry-content -->
  60. <?php } ?>
  61. <footer class="entry-footer">
  62. <?php toujours_entry_footer(); ?>
  63. </footer><!-- .entry-footer -->
  64. </article><!-- #post-## -->