예제 #1
0
		<h2 class="entry-title"><a href="<?php 
the_permalink();
?>
" title="<?php 
printf(__('Permalink to %s', 'startbox'), esc_html(get_the_title(), 1));
?>
" rel="bookmark"><?php 
the_title();
?>
</a></h2>
		<div class="entry-meta">
			By <?php 
the_author_posts_link();
?>
 | <i class="fa fa-graduation-cap"></i> <?php 
echo count($class->getStudents()) . " " . _n("Student", "Students", count($class->getStudents()));
?>
			<?php 
if ($class->isTeacher()) {
    ?>
 | <a href="/start-a-class/?edit=<?php 
    echo $class->id;
    ?>
">Edit</a><?php 
}
?>
		</div><!-- .entry-meta -->
	</div><!-- .entry-header -->

	<?php 
do_action('sb_before_post_content');
예제 #2
0
<?php

/**
 * Template for displaying all single class posts
**/
//get some vars
global $post;
$class = new SPClass($post->ID);
$class->getStudents();
//inviting?
if (!empty($_REQUEST['invite']) && !$class->isTeacher()) {
    //non-teacher trying to invite, redirect them back to class
    wp_redirect(get_permalink($post->ID));
    exit;
}
//enrolling?
if (!empty($_REQUEST['enroll'])) {
    //check for open enrollment
    if ($class->enrollment) {
        //enroll the current user
        $class->joinClass();
        //redirect to this page to reset somet things
        wp_redirect(get_permalink($post->ID));
        exit;
    } else {
        wp_die("This class does not have open enrollment.");
    }
}
get_header();
?>
	<?php