content-video.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Template part for displaying posts with the video format.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Scratchpad
  8. */
  9. /* translators: %s: Name of current post */
  10. $content_text = sprintf(
  11. wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'scratchpad' ), array( 'span' => array( 'class' => array() ) ) ),
  12. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  13. );
  14. $content = apply_filters( 'the_content', get_the_content( $content_text ) );
  15. ?>
  16. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  17. <?php scratchpad_sticky(); ?>
  18. <?php
  19. $video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
  20. if ( ! empty( $video ) ) {
  21. foreach ( $video as $video_html ) {
  22. $content = str_replace( $video_html, '', $content );
  23. ?>
  24. <div class="entry-video jetpack-video-wrapper">
  25. <?php echo $video_html; ?>
  26. <div class="movie-tickets">
  27. <?php get_template_part( 'images/inline', 'movie-ticket.svg' ); ?>
  28. <?php get_template_part( 'images/inline', 'movie-ticket.svg' ); ?>
  29. </div><!-- .movie-tickets -->
  30. </div><!-- .entry-video.jetpack-video-wrapper -->
  31. <?php
  32. } // endforeach
  33. } // endif !empty ( $media )
  34. ?>
  35. <header class="entry-header">
  36. <?php
  37. if ( is_single() ) {
  38. the_title( '<h1 class="entry-title">', '</h1>' );
  39. } else {
  40. the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
  41. }
  42. if ( 'post' === get_post_type() ) : ?>
  43. <div class="entry-meta">
  44. <?php scratchpad_post_format(); ?>
  45. <?php scratchpad_posted_on(); ?>
  46. <?php
  47. edit_post_link(
  48. sprintf(
  49. /* translators: %s: Name of current post */
  50. esc_html__( 'Edit %s', 'scratchpad' ),
  51. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  52. ),
  53. '<span class="edit-link"><span class="sep">&bull;</span>',
  54. '</span>'
  55. );
  56. ?>
  57. </div><!-- .entry-meta -->
  58. <?php
  59. endif; ?>
  60. </header><!-- .entry-header -->
  61. <?php if ( post_password_required() ) {
  62. the_content();
  63. } ?>
  64. </article><!-- #post-## -->