Advertisement
nwtd

CoursePress sing-unit.php

Feb 18th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The Template for displaying single unit posts with modules
  4.  *
  5.  * @package CoursePress
  6.  */
  7. global $coursepress, $wp, $wp_query;
  8.  
  9. $course_id = do_shortcode('[get_parent_course_id]');
  10.  
  11. add_thickbox();
  12.  
  13. $paged = ! empty( $wp->query_vars['paged'] ) ? absint($wp->query_vars['paged']) : 1;
  14. //redirect to the parent course page if not enrolled or not preview unit/page
  15. while ( have_posts() ) : the_post();
  16.     $coursepress->check_access($course_id, get_the_ID());
  17. endwhile;
  18.  
  19. get_header();
  20.  
  21. $post = $unit->details;
  22. ?>
  23.  
  24. <div id="primary" class="content-area">
  25.     <main id="main" class="site-main" role="main">
  26.         <?php while ( have_posts() ) : the_post(); ?>
  27.             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  28.                 <header class="entry-header">
  29.                     <h3 class="entry-title"><?php echo do_shortcode('[course_title course_id="' . $course_id . '"]'); ?></h3>
  30.                     <?php
  31.                     //echo do_shortcode('[course_unit_details unit_id="' . get_the_ID() . '" field="parent_course"]');
  32.                     ?>
  33.                 </header><!-- .entry-header -->
  34.                 <div class="instructors-content"></div>
  35.                 <?php
  36.                 echo do_shortcode('[course_unit_archive_submenu course_id="' . $course_id . '"]');
  37.                 ?>
  38.  
  39.                 <div class="clearfix"></div>
  40.  
  41.                 <?php echo do_shortcode('[course_unit_details unit_id="' . get_the_ID() . '" field="unit_page_title" unit_title="'.get_the_title().'"]'); ?>
  42.  
  43.                 <div class="entry-content">
  44.                     <?php
  45.                     if ( $paged == 1 ) { //Unit introduction will be shown only on the first page
  46.                         the_content();
  47.                     }
  48.                     ?>
  49.                 </div>
  50.                 <?php
  51.                 Unit_Module::get_modules_front($unit->details->ID);
  52.                 ?>
  53.             </article>
  54.         <?php endwhile; // end of the loop. ?>
  55.     </main><!-- #main -->
  56. </div><!-- #primary -->
  57.  
  58. <?php get_sidebar('footer'); ?>
  59. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement