In this tutorial, I show you how to get started with adding course curriculum/downloads to the “Thank You” page after payment.
Adding a downloads section to the “Thank You” page will allow you to add things like course curriculum or allow registrants to download files that are only accessible after they pay for a class or event.
For this particular tutorial, we will be using two different ACF add-ons to add a “Course Curriculum” section and a few courses to the Event Espresso “Thank You” page. So please make sure you have the “Repeater Field” and “Flexible Content Field” add-ons for ACF installed and ready to go before we start this tutorial.
Add a New ACF Field Group for Course Curriculum
- Create a new ACF Field Group (WP Admin > Custom Fields > Add New) [screenshot]
- Using the screen shot as a guide, add the following fields to the group:
- Class Courses (class_courses | Flexible Content)
Label: Course Material
Name: course
Display: Row- Course Name (course_name | text)
- Course Description (course_description | textarea)
- Course Image (course_image | image)
- Course Files (course_files | repeater)
- Course File (course_file | File)
- Class Courses (class_courses | Flexible Content)
- Set the “Show this field group if ” setting to “Post Type > is equal to > espresso_events”.
- [optional] Change the order, position, and style of the meta box in the EE4 event editor.
Add a Custom Hook
Next we need to add the code that will output the course curriculum. There are actually two options, which I will outline below:
- Option 1: Child Theme
Add the following code to the functions.php file in a child theme. For more information about child themes, checkout the WordPress Child Theme Documentation. - Option 2: Site-specific Plugin
[Recommended] Create a site specific plugin using the code below. For more information about site specific plugins, check out our documentation on the subject.
The snippet above uses an EE4 action hook called
AHEE__thank_you_page_registration_details_template__after_registration_table_row
to display the contents of the
ee_course_materials_section_thank_you_page()
function, which contains the HTML for the new section to download the course materials. The data for the ACF fields are pulled from the WP global $post variable.
Create a New Event & Add Course Materials
- Create a new Event Espresso event (WP Admin > Event Espresso > Events > Add New Event)
- In the new meta box generated by ACF using the steps outlined above, add the course details and files to the event. [screenshot]
- Publish the event.
Finishing up the course curriculum section
That covers adding a course curriculum section to a single event on the thank you page. After successfully registering and paying for an event, you should end up with something like this on the payment page:
Related
Adding Related Events Using Advanced Custom Fields
Add a Sponsors Section to Events Using Advanced Custom Fields