Skip to content

Instantly share code, notes, and snippets.

@kpennell
Created April 21, 2017 01:03
Show Gist options
  • Save kpennell/8aff71a2163f6c7832f8b275a9d606c7 to your computer and use it in GitHub Desktop.
Save kpennell/8aff71a2163f6c7832f8b275a9d606c7 to your computer and use it in GitHub Desktop.
<?php
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
?>
<?php get_header(); ?>
<div id="content" <?php Avada()->layout->add_style( 'content_style' ); ?>>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post' ); ?>>
<?php $full_image = ''; ?>
<?php if ( 'above' == Avada()->settings->get( 'blog_post_title' ) ) : ?>
<?php echo avada_render_post_title( $post->ID, false, '', '2' ); ?>
<?php elseif ( 'disabled' == Avada()->settings->get( 'blog_post_title' ) && Avada()->settings->get( 'disable_date_rich_snippet_pages' ) ) : ?>
<span class="entry-title" style="display: none;"><?php the_title(); ?></span>
<?php endif; ?>
<?php /*if ( ! post_password_required( $post->ID ) ) : ?>
<?php if ( Avada()->settings->get( 'featured_images_single' ) ) : ?>
<?php if ( 0 < avada_number_of_featured_images() || get_post_meta( $post->ID, 'pyre_video', true ) ) : ?>
<?php Avada()->images->set_grid_image_meta( array( 'layout' => strtolower( 'large' ), 'columns' => '1' ) ); ?>
<div class="fusion-flexslider flexslider fusion-flexslider-loading post-slideshow fusion-post-slideshow">
<ul class="slides">
<?php if ( get_post_meta( $post->ID, 'pyre_video', true ) ) : ?>
<li>
<div class="full-video">
<?php echo get_post_meta( $post->ID, 'pyre_video', true ); ?>
</div>
</li>
<?php endif; ?>
<?php if ( has_post_thumbnail() && 'yes' != get_post_meta( $post->ID, 'pyre_show_first_featured_image', true ) ) : ?>
<?php $attachment_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); ?>
<?php $full_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); ?>
<?php $attachment_data = wp_get_attachment_metadata( get_post_thumbnail_id() ); ?>
<li>
<?php if ( Avada()->settings->get( 'status_lightbox' ) && Avada()->settings->get( 'status_lightbox_single' ) ) : ?>
<a href="<?php echo $full_image[0]; ?>" data-rel="iLightbox[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field( 'post_excerpt', get_post_thumbnail_id() ); ?>" data-title="<?php echo get_post_field( 'post_title', get_post_thumbnail_id() ); ?>" data-caption="<?php echo get_post_field( 'post_excerpt', get_post_thumbnail_id() ); ?>">
<span class="screen-reader-text"><?php esc_attr_e( 'View Larger Image', 'Avada' ); ?></span>
<?php echo get_the_post_thumbnail( $post->ID, 'full' ); ?>
</a>
<?php else : ?>
<?php echo get_the_post_thumbnail( $post->ID, 'full' ); ?>
<?php endif; ?>
</li>
<?php endif; ?>
<?php $i = 2; ?>
<?php while ( $i <= Avada()->settings->get( 'posts_slideshow_number' ) ) : ?>
<?php $attachment_new_id = kd_mfi_get_featured_image_id( 'featured-image-' . $i, 'post' ); ?>
<?php if ( $attachment_new_id ) : ?>
<?php $attachment_image = wp_get_attachment_image_src( $attachment_new_id, 'full' ); ?>
<?php $full_image = wp_get_attachment_image_src( $attachment_new_id, 'full' ); ?>
<?php $attachment_data = wp_get_attachment_metadata( $attachment_new_id ); ?>
<li>
<?php if ( Avada()->settings->get( 'status_lightbox' ) && Avada()->settings->get( 'status_lightbox_single' ) ) : ?>
<a href="<?php echo $full_image[0]; ?>" data-rel="iLightbox[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field( 'post_excerpt', $attachment_new_id ); ?>" data-title="<?php echo get_post_field( 'post_title', $attachment_new_id ); ?>" data-caption="<?php echo get_post_field( 'post_excerpt', $attachment_new_id ); ?>">
<?php echo wp_get_attachment_image( $attachment_new_id, 'full' ); ?>
</a>
<?php else : ?>
<?php echo wp_get_attachment_image( $attachment_new_id, 'full' ); ?>
<?php endif; ?>
</li>
<?php endif; ?>
<?php $i++; ?>
<?php endwhile; ?>
</ul>
</div>
<?php Avada()->images->set_grid_image_meta( array() ); ?>
<?php endif; ?>
<?php endif; ?>
<?php endif;*/ ?>
<?php if ( 'below' == Avada()->settings->get( 'blog_post_title' ) ) : ?>
<?php echo avada_render_post_title( $post->ID, false, '', '2' ); ?>
<?php endif; ?>
<div class="post-content">
<?php
if ( function_exists('bcn_display') ) {
echo '<div id="breadcrumbs">'. bcn_display( $return = true ) .'</div>';
}
?>
<?php
// Get Featured Image
$featured_image = '';
if ( has_post_thumbnail() && 'yes' != get_post_meta( $post->ID, 'pyre_show_first_featured_image', true ) ) {
$featured_image = '<div class="course-image">'. get_the_post_thumbnail( $post->ID, 'full' ) .'</div>';
}
// Get Categories
$categories = '';
$cats = get_the_term_list( get_the_ID(), 'course_category', '', ', ', '' );
if( $cats ) {
$categories = '<h4>Course Category</h4><h3>'. $cats .'</h3>';
}
// Get Duration
$duration = '';
if( !empty( get_field('duration') ) )
$duration = '<h4>Duration</h4><h3>'. get_field('duration') .'</h3>';
// Get Skill Level categories
$skill_classes = '';
$skill_level = '';
$skills = get_the_terms( $post->ID, 'skill_level' );
if ( $skills ) {
foreach ( $skills as $skill ) {
$skill_classes .= urldecode( $skill->slug ) . ' ';
}
$skill_level = sprintf( '<h4>Skill Level</h4><div class="skill-level %s"><h3>%s</h3></div>',
$skill_classes, get_the_term_list( get_the_ID(), 'skill_level', '', ', ', '' ) );
}
// Get Relevant Materials
$rel_materials = '';
if( !empty( get_field('relevant_materials') ) )
$rel_materials = '<h4>Relevant Materials</h4><h3>'. get_field('relevant_materials') .'</h3>';
// Get Style
$style = '';
if( !empty( get_field('style') ) )
$style = '<h4>Style</h4><h3>'. get_field('style') .'</h3>';
// Get Instructors loop
$instructors = get_field( 'instructors' );
$instrustor_html = '';
if( $instructors ) {
foreach( $instructors as $post ) {
setup_postdata( $post );
// Get instructor values.
$name = get_the_title();
$link = get_the_permalink();
$image_id = get_post_thumbnail_id();
$image_url = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
$description = get_the_content();
$description = mb_strimwidth($description, 0, 400, '...');
$position = get_field('job_position');
$website = get_field('website');
$facebook = get_field('facebook');
$linkedin = get_field('linkedin');
$twitter = get_field('twitter');
$googleplus = get_field('googleplus');
$youtube = get_field('youtube');
$instrustor_html .= '
[fusion_builder_container hundred_percent="no" equal_height_columns="no" hide_on_mobile="small-visibility,medium-visibility,large-visibility" background_color="#f7f7f7" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" overlay_opacity="0.5" border_style="solid" padding_top="50px" padding_bottom="0px"][fusion_builder_row]
[fusion_builder_column type="1_1" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="undefined" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"]
[fusion_text]
<h3 style="margin:0;">About the Instructor</h3>
[/fusion_text]
[/fusion_builder_column]
[fusion_builder_column type="1_4" layout="1_1" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no" element_content=""]
[fusion_imageframe image_id="'. $image_id .'" style_type="none" hover_type="none" borderradius="round" align="center" lightbox="no" alt="'. $name .'" link="'. $link .'" linktarget="_self" hide_on_mobile="small-visibility,medium-visibility,large-visibility" animation_direction="left" animation_speed="0.3"]'. $image_url .'[/fusion_imageframe]
[fusion_separator style_type="none" hide_on_mobile="small-visibility,medium-visibility,large-visibility" bottom_margin="15px" border_size="0" alignment="center" /]
[fusion_social_links color_type="brand" alignment="center" facebook="'. $facebook .'" googleplus="'. $googleplus .'" linkedin="'. $linkedin .'" twitter="'. $twitter .'" youtube="'. $youtube .'" show_custom="no" hide_on_mobile="small-visibility,medium-visibility,large-visibility" /]
[/fusion_builder_column][fusion_builder_column type="3_5" layout="1_1" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no" element_content=""]
[fusion_text]
<h3 style="margin:0;"><a href="'. $link .'">'. $name .'</a></h3>
<p><strong>'. $position .'</strong></p>
'. $description .' <a href="'. $link .'">read more</a>
[/fusion_text]
[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
';
}
wp_reset_postdata();
}
?>
<?php
// Render the full course content
echo do_shortcode('
[fusion_builder_container hundred_percent="no" equal_height_columns="no" hide_on_mobile="small-visibility,medium-visibility,large-visibility" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" overlay_opacity="0.5" border_style="solid" padding_top="20px" padding_right="0px" padding_bottom="20px" padding_left="0px"][fusion_builder_row][fusion_builder_column type="1_2" layout="1_1" background_position="left top" background_color="" border_size="" border_color="" border_style="solid" border_position="all" spacing="yes" background_image="" background_repeat="no-repeat" padding="" margin_top="0px" margin_bottom="0px" class="" id="" animation_type="" animation_speed="0.3" animation_direction="left" hide_on_mobile="small-visibility,medium-visibility,large-visibility" center_content="no" last="no" min_height="" hover_type="none" link=""]
[fusion_title hide_on_mobile="small-visibility,medium-visibility,large-visibility" size="2" content_align="left" style_type="default"]About This Course[/fusion_title]
[fusion_text]'. get_the_content() .'[/fusion_text]
[fusion_button target="_self" modal="moreinfo" hide_on_mobile="small-visibility,medium-visibility,large-visibility" color="custom" button_gradient_top_color="#17aa1c" button_gradient_bottom_color="#17aa1c" button_gradient_top_color_hover="#108912" button_gradient_bottom_color_hover="#108912" stretch="default" icon_position="left" icon_divider="no" animation_direction="left" animation_speed="0.3"]Request More Info About This Course[/fusion_button]
[fusion_modal name="moreinfo" title="Request Info About This Course" size="large" background="#233345" border_color="#172738" show_footer="no" class="moreinfo-modal"][salesforce form="2"][/fusion_modal]
[/fusion_builder_column][fusion_builder_column type="1_2" layout="1_2" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="course-block" id="" background_color="" background_image="" background_position="left top" undefined="" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" margin_top="" margin_bottom="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"]
[fusion_text]
'. $featured_image .'
'. $categories .'
'. $duration .'
'. $skill_level .'
'. $style .'
'. $rel_materials .'
[/fusion_text]
[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
[fusion_builder_container hundred_percent="no" equal_height_columns="no" hide_on_mobile="small-visibility,medium-visibility,large-visibility" background_color="#f7f7f7" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" overlay_opacity="0.5" border_style="solid" padding_top="50px" padding_right="0px" padding_bottom="20px" padding_left="0px"][fusion_builder_row][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no" element_content=""][/fusion_builder_column][fusion_builder_column type="2_3" layout="1_1" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"]
[fusion_title hide_on_mobile="small-visibility,medium-visibility,large-visibility" size="2" content_align="left" style_type="default"]What You\'ll Learn[/fusion_title]
[fusion_text]'. get_field('what_youll_learn') .'[/fusion_text]
[/fusion_builder_column][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no" element_content=""][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
[fusion_builder_container hundred_percent="no" equal_height_columns="yes" hide_on_mobile="small-visibility,medium-visibility,large-visibility" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" overlay_opacity="0.5" border_style="solid" padding_top="50px" padding_right="0px" padding_bottom="20px" padding_left="0px"][fusion_builder_row][fusion_builder_column type="1_2" layout="1_2" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" undefined="" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" margin_top="" margin_bottom="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"]
[fusion_title hide_on_mobile="small-visibility,medium-visibility,large-visibility" size="2" content_align="left" style_type="default"]Course Outline[/fusion_title]
[fusion_text]'. get_field('course_outline') .'[/fusion_text]
[/fusion_builder_column][fusion_builder_column type="1_2" layout="1_2" spacing="" center_content="no" hover_type="none" link="" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" undefined="" background_repeat="no-repeat" border_size="0" border_color="" border_style="solid" border_position="all" padding="" margin_top="" margin_bottom="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"]
[fusion_title hide_on_mobile="small-visibility,medium-visibility,large-visibility" size="2" content_align="left" style_type="default"]Purpose[/fusion_title]
[fusion_text]'. get_field('purpose') .'[/fusion_text]
[fusion_title hide_on_mobile="small-visibility,medium-visibility,large-visibility" size="2" content_align="left" style_type="default"]Audience[/fusion_title]
[fusion_text]'. get_field('audience') .'[/fusion_text]
[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
'. $instrustor_html .'
'); ?>
</div>
<div class="related-wrap">
<?php // Render Related Posts
//echo avada_render_related_posts( 'avada_course' );
related_posts();
/*$html = '';
$related_posts = fusion_get_custom_posttype_related_posts( get_the_ID(), '3', 'avada_course' );
print_r($related_posts);
// If there are related posts, display them.
//if ( isset( $related_posts ) && $related_posts->have_posts() ) {
ob_start();
include( locate_template( 'templates/related-posts.php' ) );
$html .= ob_get_clean();
//}
echo $html;*/ ?>
</div>
<?php
//echo avada_render_related_posts( 'course' ); ?>
<?php /*if ( ! post_password_required( $post->ID ) ) : ?>
<?php if ( ( Avada()->settings->get( 'blog_comments' ) && 'no' != get_post_meta( $post->ID, 'pyre_post_comments', true ) ) || ( ! Avada()->settings->get( 'blog_comments' ) && 'yes' == get_post_meta( $post->ID, 'pyre_post_comments', true ) ) ) : ?>
<?php wp_reset_query(); ?>
<?php comments_template(); ?>
<?php endif; ?>
<?php endif;*/ ?>
</article>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<?php if ( ( Avada()->settings->get( 'blog_pn_nav' ) && 'no' != get_post_meta( $post->ID, 'pyre_post_pagination', true ) ) || ( ! Avada()->settings->get( 'blog_pn_nav' ) && 'yes' == get_post_meta( $post->ID, 'pyre_post_pagination', true ) ) ) : ?>
<div class="single-navigation clearfix" style="padding-bottom: 10px;">
<?php //avada_render_social_sharing(); ?>
<?php previous_post_link( '%link', esc_attr__( 'Previous Course', 'Avada' ) ); ?>
<?php next_post_link( '%link', esc_attr__( 'Next Course', 'Avada' ) ); ?>
</div>
<?php endif; ?>
</div>
<?php get_footer();
/* Omit closing PHP tag to avoid "Headers already sent" issues. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment