Guest User

Untitled

a guest
Feb 25th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. <?php
  2. /**
  3. * The Template for displaying all single lessons.
  4. *
  5. * Override this template by copying it to yourtheme/sensei/single-lesson.php
  6. *
  7. * @author Automattic
  8. * @package Sensei
  9. * @category Templates
  10. * @version 1.9.0
  11. */
  12. ?>
  13. <?php get_sensei_header(); ?>
  14. <?php the_post(); ?>
  15. <article <?php post_class( array( 'lesson', 'post' ) ); ?>>
  16. <?php
  17. /**
  18. * Hook inside the single lesson above the content
  19. *
  20. * @since 1.9.0
  21. *
  22. * @param integer $lesson_id
  23. *
  24. * @hooked deprecated_lesson_image_hook - 10
  25. * @hooked deprecate_sensei_lesson_single_title - 15
  26. * @hooked Sensei_Lesson::lesson_image() - 17
  27. * @hooked deprecate_lesson_single_main_content_hook - 20
  28. */
  29. do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() );
  30. ?>
  31. <section class="entry fix">
  32. <?php
  33. if ( sensei_can_user_view_lesson() ) {
  34. ?>
  35. <span id="lesson-duration" style="display:none;" data-duration="<?php echo get_post_meta( $post->ID, '_lesson_length', true ); ?>"></span>
  36. <script>
  37. jQuery(function() {
  38. var duration = "<?php echo get_post_meta( $post->ID, '_lesson_length', true); ?>";
  39. if (Number(duration) > 10) {
  40. duration = Number(duration);
  41. var storage = window.localStorage || {getItem: function(){}, setItem: function(){}};
  42. var watchKey = '__cur_watch_time__';
  43. var curWatchTime = Number(storage.getItem(watchKey));
  44. var showTimeout = (duration - 10) * 60000;
  45. var hideTimeout = (duration + 60) * 60000;
  46. var timerFunc = function() {
  47. curWatchTime += 60000;
  48. storage.setItem(watchKey, curWatchTime);
  49. if (curWatchTime >= showTimeout) {
  50. jQuery("#et-main-area #content #main article footer p a.button").show();
  51. }
  52. if (curWatchTime >= hideTimeout) {
  53. jQuery("#main .entry .video").hide();
  54. window.clearInterval(timer);
  55. }
  56. }
  57. var timer = window.setInterval(timerFunc, 60000);
  58. if (curWatchTime >= hideTimeout) {
  59. timerFunc();
  60. }
  61. }
  62. });
  63. </script>
  64. <?php
  65. if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) {
  66. do_action( 'sensei_lesson_video', $post->ID );
  67. }
  68. the_content();
  69. } else {
  70. ?>
  71. <p> <?php the_excerpt(); ?> </p>
  72. <?php
  73. }
  74. ?>
  75. </section>
  76. <style>
  77. #et-main-area #content #main article footer p a.button { display: none; }
  78. </style>
  79. <?php
  80. /**
  81. * Hook inside the single lesson template after the content
  82. *
  83. * @since 1.9.0
  84. *
  85. * @param integer $lesson_id
  86. *
  87. * @hooked Sensei()->frontend->sensei_breadcrumb - 30
  88. */
  89. do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() );
  90. ?>
  91. </article><!-- .post -->
  92. <?php get_sensei_footer(); ?>
Add Comment
Please, Sign In to add comment