Add a Course Curriculum Section to the “Thank You” Page Using Advanced Custom Fields

Add a Course Curriculum Section to the “Thank You” Page Using Advanced Custom Fields

Requires Event Espresso 4.8

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.

It is assumed that you are familiar with ACF, are capable of adding new fields to WordPress posts/custom post types, and can add new hooks to your WordPress theme/functions.php. If you are unfamiliar with ACF, please refer to the details and documentation on the Advanced Custom Fields website.

Add a New ACF Field Group for Course Curriculum

  1. acf-ee-add-new-curriculumCreate a new ACF Field Group (WP Admin > Custom Fields > Add New) [screenshot]
  2. Using the screen shot as a guide, add the following fields to the group:
    1. Class Courses (class_courses | Flexible Content)
      Label: Course Material
      Name: course
      Display: Row

      1. Course Name (course_name | text)
      2. Course Description (course_description | textarea)
      3. Course Image (course_image | image)
      4. Course Files (course_files | repeater)
      5. Course File (course_file | File)
  3. Set the “Show this field group if ” setting to “Post Type > is equal to > espresso_events”.
  4. [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.


acf-ee-add-new-curriculum-eventCreate a New Event & Add Course Materials

  1. Create a new Event Espresso event (WP Admin > Event Espresso > Events > Add New Event)
  2. In the new meta box generated by ACF using the steps outlined above, add the course details and files to the event. [screenshot]
  3. 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:

acf-ee-curriculum-thank-you-page

Related

Adding Related Events Using Advanced Custom Fields

Add a Sponsors Section to Events Using Advanced Custom Fields


Need more help?

Do NOT follow this link or you will be banned from the site!