説明なし

podcast-header-title.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Podcast Header Title template.
  4. *
  5. * @package automattic/jetpack
  6. */
  7. namespace Automattic\Jetpack\Extensions\Podcast_Player;
  8. /**
  9. * Template variables.
  10. *
  11. * @var string $template_props
  12. */
  13. if ( ! isset( $template_props['title'] ) && empty( $template_props['track']['title'] ) ) {
  14. return;
  15. }
  16. $track_link = empty( $template_props['track']['link'] ) ? $template_props['track']['src'] : $template_props['track']['link'];
  17. ?>
  18. <h2 id="<?php echo esc_attr( $template_props['player_id'] ); ?>__title" class="jetpack-podcast-player__title">
  19. <span
  20. class="jetpack-podcast-player__current-track-title <?php echo esc_attr( $template_props['primary_colors']['class'] ); ?>"
  21. <?php echo isset( $template_props['primary_colors']['style'] ) ? 'style="' . esc_attr( $template_props['primary_colors']['style'] ) . '"' : ''; ?>
  22. >
  23. <?php
  24. echo esc_html( $template_props['track']['title'] );
  25. if ( ! empty( $track_link ) ) :
  26. // Prevent whitespace between title and link to cause a jump when JS kicks in.
  27. // phpcs:disable Squiz.PHP.EmbeddedPhp.ContentAfterEnd
  28. ?><a
  29. class="jetpack-podcast-player__track-title-link"
  30. href="<?php echo esc_url( $track_link ); ?>"
  31. target="_blank"
  32. rel="noopener noreferrer nofollow"
  33. >
  34. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
  35. <path d="M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z" />
  36. </svg>
  37. </a>
  38. <?php endif; // phpcs:enable ?>
  39. </span>
  40. <?php if ( ! empty( $template_props['title'] ) ) : ?>
  41. <span class="jetpack-podcast-player--visually-hidden"> - </span>
  42. <?php
  43. render(
  44. 'podcast-title',
  45. array(
  46. 'title' => $template_props['title'],
  47. 'link' => $template_props['link'],
  48. )
  49. );
  50. ?>
  51. <?php endif; ?>
  52. </h2>