PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/esquire/content-audio.php

https://github.com/Bochet/festival_lgbt
PHP | 74 lines | 60 code | 8 blank | 6 comment | 11 complexity | 7c3b6fd971ff0b475e751cedd7d65f0b MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * The template for displaying Image Posts
  4. *
  5. * @package Esquire
  6. * @since Esquire 1.0
  7. */
  8. $audio_file = esquire_audio_grabber( $post->ID );
  9. ?>
  10. <div <?php post_class(); ?>>
  11. <?php if ( ! is_page() ) : ?>
  12. <div class="datebox">
  13. <p class="day"><?php the_time( 'd' ); ?></p>
  14. <p class="month"><?php the_time( 'M' ); ?></p>
  15. </div>
  16. <?php endif; ?>
  17. <div class="postbody audio">
  18. <div class="content">
  19. <?php if ( has_post_thumbnail() ) :
  20. $album_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'audio' ); ?>
  21. <div class="artwork">
  22. <div class="overlay"></div>
  23. <img src="<?php echo $album_image[0]; ?>" width="207" height="207" alt="<?php esc_attr_e( 'Album Art', 'esquire' ); ?>" />
  24. </div>
  25. <?php endif; ?>
  26. <?php if ( ! empty( $audio_file ) ) : ?>
  27. <div class="player">
  28. <audio controls autobuffer id="audio-player-<?php echo $post->ID; ?>" src="<?php echo $audio_file; ?>">
  29. <source src="<?php echo $audio_file; ?>" type="audio/mp3" />
  30. </audio>
  31. <script type="text/javascript">
  32. var audioTag = document.createElement('audio');
  33. if ( ! ( !! ( audioTag.canPlayType ) && ( "no" != audioTag.canPlayType("audio/mpeg" ) ) && ( '' != audioTag.canPlayType( 'audio/mpeg' ) ) ) ) {
  34. AudioPlayer.embed(
  35. "audio-player-<?php echo $post->ID; ?>", {
  36. soundFile: "<?php echo $audio_file; ?>",
  37. animation: 'no',
  38. width: '400'
  39. }
  40. );
  41. }
  42. </script>
  43. </div>
  44. <?php endif; ?>
  45. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'esquire' ) ); ?>
  46. <?php wp_link_pages( array( 'before' => '<p class="page-link"><span>' . __( 'Pages:', 'esquire' ) . '</span>', 'after' => '</p>' ) ); ?>
  47. </div><!-- .content -->
  48. <?php comments_template( '', true ); ?>
  49. <div class="meta bar">
  50. <p class="permalink">
  51. <?php if ( ! is_page() ) : ?>
  52. <a href="<?php the_permalink(); ?>"><span rel="<?php the_time( get_option( 'date_format' ) ); ?>"><?php printf( __( '%1$s ago', 'esquire' ), human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) ); ?></span></a>
  53. <?php endif; ?>
  54. <a href="<?php echo wp_get_shortlink(); ?> " class="shorturl"><span><?php _e( 'Short URL', 'esquire' ); ?></span></a>
  55. <?php comments_popup_link( '<span>' . __( 'Comments', 'esquire' ) . '</span>', '<span>' . __( '1 Comment', 'esquire' ) . '</span>', '<span>' . __( '% Comments', 'esquire' ) . '</span>', 'comment-count', '' ); ?>
  56. <?php edit_post_link( __( 'Edit', 'esquire' ) ); ?>
  57. </p>
  58. <div class="tagbar">
  59. <?php if ( 1 != esquire_category_counter() ) : ?>
  60. <p class="tags cats"><?php the_category( '<span>/</span>' ); ?></p>
  61. <?php endif; ?>
  62. <?php the_tags( '<p class="tags">', '<span>/</span>', '</p>' ); ?>
  63. </div><!-- .tagbar -->
  64. </div><!-- .meta .bar -->
  65. </div><!-- .postbody .text -->
  66. </div><!-- .post -->