[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyseventeen/template-parts/post/ -> content-video.php (source)

   1  <?php
   2  /**
   3   * Template part for displaying video posts
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Seventeen
   9   * @since Twenty Seventeen 1.0
  10   * @version 1.2
  11   */
  12  
  13  ?>
  14  
  15  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  16      <?php
  17      if ( is_sticky() && is_home() ) {
  18          echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
  19      }
  20      ?>
  21      <header class="entry-header">
  22          <?php
  23          if ( 'post' === get_post_type() ) {
  24              echo '<div class="entry-meta">';
  25              if ( is_single() ) {
  26                  twentyseventeen_posted_on();
  27              } else {
  28                  echo twentyseventeen_time_link();
  29                  twentyseventeen_edit_link();
  30              }
  31              echo '</div><!-- .entry-meta -->';
  32          }
  33  
  34          if ( is_single() ) {
  35              the_title( '<h1 class="entry-title">', '</h1>' );
  36          } elseif ( is_front_page() && is_home() ) {
  37              the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
  38          } else {
  39              the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
  40          }
  41          ?>
  42      </header><!-- .entry-header -->
  43  
  44      <?php
  45          $content = apply_filters( 'the_content', get_the_content() );
  46          $video   = false;
  47  
  48          // Only get video from the content if a playlist isn't present.
  49      if ( false === strpos( $content, 'wp-playlist-script' ) ) {
  50          $video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
  51      }
  52      ?>
  53  
  54      <?php if ( '' !== get_the_post_thumbnail() && ! is_single() && empty( $video ) ) : ?>
  55          <div class="post-thumbnail">
  56              <a href="<?php the_permalink(); ?>">
  57                  <?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?>
  58              </a>
  59          </div><!-- .post-thumbnail -->
  60      <?php endif; ?>
  61  
  62      <div class="entry-content">
  63  
  64          <?php
  65          if ( ! is_single() ) {
  66  
  67              // If not a single post, highlight the video file.
  68              if ( ! empty( $video ) ) {
  69                  foreach ( $video as $video_html ) {
  70                      echo '<div class="entry-video">';
  71                          echo $video_html;
  72                      echo '</div>';
  73                  }
  74              }
  75          }
  76  
  77          if ( is_single() || empty( $video ) ) {
  78  
  79              the_content(
  80                  sprintf(
  81                      /* translators: %s: Post title. Only visible to screen readers. */
  82                      __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  83                      get_the_title()
  84                  )
  85              );
  86  
  87              wp_link_pages(
  88                  array(
  89                      'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
  90                      'after'       => '</div>',
  91                      'link_before' => '<span class="page-number">',
  92                      'link_after'  => '</span>',
  93                  )
  94              );
  95          }
  96          ?>
  97  
  98      </div><!-- .entry-content -->
  99  
 100      <?php
 101      if ( is_single() ) {
 102          twentyseventeen_entry_footer();
 103      }
 104      ?>
 105  
 106  </article><!-- #post-<?php the_ID(); ?> -->


Generated: Wed Nov 6 01:00:02 2024 Cross-referenced by PHPXref 0.7.1