Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active February 20, 2017 20:43
Show Gist options
  • Save joshfeck/eda214fb8c0227690fb797907a046b1d to your computer and use it in GitHub Desktop.
Save joshfeck/eda214fb8c0227690fb797907a046b1d to your computer and use it in GitHub Desktop.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_course_materials_section_thank_you_page( $registration ) {
if ( $registration instanceof EE_Registration ) {
if( get_field('class_courses', $registration->event()->ID()) ):
?>
<tr>
<td colspan="3">
<div class="course_materials">
<h3><span class="dashicons dashicons-download"></span>Download Course Curriculum</h3>
<?php while(the_flexible_field("class_courses", $registration->event()->ID())): ?>
<?php if(get_row_layout() == "course"): // layout: Featured Posts ?>
<div>
<h2><img align="right" src="<?php the_sub_field( "course_image", $registration->event()->ID() )?>"><?php the_sub_field("course_name", $registration->event()->ID()); ?></h2>
<?php the_sub_field("course_description", $registration->event()->ID()); ?>
<?php if(get_sub_field("course_files", $registration->event()->ID())): ?>
<ul>
<?php foreach(get_sub_field("course_files", $registration->event()->ID()) as $cf): ?>
<li><a href="<?php echo $cf['course_file']['url']; ?>"><?php echo $cf['course_file']['title'];?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endwhile; ?>
</td>
</tr>
<?php
endif;
}
}
add_action(
'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
'ee_course_materials_section_thank_you_page',
10,
1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment