content-video.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Template part for displaying video 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. $video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
  21. if ( ! empty( $video ) ) {
  22. foreach ( $video as $video_html ) {
  23. $content = str_replace( $video_html, '', $content );
  24. ?>
  25. <div class="entry-video jetpack-video-wrapper">
  26. <?php echo $video_html; ?>
  27. </div><!-- .entry-video.jetpack-video-wrapper -->
  28. <?php
  29. } // endforeach
  30. } // endif !empty ( $media )
  31. ?>
  32. <header class="entry-header">
  33. <?php if ( is_sticky() && is_home() ) { ?>
  34. <span class="featured-post"><?php esc_html_e( 'Featured', 'toujours' ); ?></span>
  35. <?php } ?>
  36. <?php if ( ! is_single() ) {
  37. the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
  38. } else {
  39. the_title( '<h2 class="entry-title">', '</h2>' );
  40. } ?>
  41. <?php if ( 'post' === get_post_type() ) : ?>
  42. <div class="entry-meta">
  43. <?php
  44. toujours_posted_on();
  45. toujours_comment_link();
  46. ?>
  47. </div><!-- .entry-meta -->
  48. <?php endif; ?>
  49. </header><!-- .entry-header -->
  50. <?php if ( '' !== $post->post_content ) { ?>
  51. <div class="entry-content">
  52. <?php echo $content; ?>
  53. <?php
  54. wp_link_pages( array(
  55. 'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', 'toujours' ) . '</span>',
  56. 'after' => '</div>',
  57. 'pagelink' => '<span class="page-links-num">%</span>'
  58. ) );
  59. ?>
  60. </div><!-- .entry-content -->
  61. <?php } ?>
  62. <footer class="entry-footer">
  63. <?php toujours_entry_footer(); ?>
  64. </footer><!-- .entry-footer -->
  65. </article><!-- #post-## -->