Category Archives: WordPress Theme

How to Redirect to Custom Page After Completing a LearnDash Course

One of the features I recently finished for the my redesign of my JavaScript for WordPress site was to have users taken to a special page once they complete a course.

You can do this a number of ways, but here is how I did it:

 

1. Setup Congratulations Pages for Each Course

The first thing I did was create a parent page called Congratulations with the url of “/congrats.”

Then I created Child Pages, one for each course.  Those pages looked something like this.

Screen Shot 2017-06-02 at 2.29.43 PM.png

You can see the badge displayed and the number of points earned (I use BadgeOS and BadgeOS LearnDash Add-on).

The most important thing I did was give each page the same slug as the course it is tied to.  If I didn’t do this, then the next step wouldn’t work as coded.

 

2. Add This Code to Your Functions.php

The next step was to find the LearnDash hook that fires when a LearnDash course completes.

Luckily there is a learndash_course_completion_url hook that let’s return a URL and the redirect happens automatically.

This code gets the slug for the completed course and then creates a new URL string of “/congrats/course-slug.”

NOTE: This will only work if you you did these two things from Step 1.

  • Create a parent page with the URL slug of “congrats”
  • Create child pages for each course using the same URL slug as the course

 

Hope this Helps!

If you have a LearnDash account you can access the list of Action and Filter Hooks here.  Since that page is password protected, thought I would share this snippet with you.

Hope it helps!

Learn How I Built the JavaScript for WordPress Master Course and Teaching Site on the “How I Built It Podcast”

“If you’re looking to setup an online course just grab this podcast!”

I love hanging and chatting Joe Casabona.  Naturally, I was excited when I found out he wanted to chat with me on his How I Built it Podcast about how I built my JavaScript for WordPress Master Course.

A lot of folks have asked me content related questions about the course, but this is the first time I really go in depth about actually building the course, from researching content, to building a team, to picking an LMS, all the plugins I used and several of the snags I hit.

It was really fun to talk about all of this and I share a lot of information.  If you’re interested in how things are built and the behind the scenes technologies, I would definitely recommend listening to this episode.

Students may particularly appreciate what has gone into the course.

Episode 9: Zac Gordon & Javascript for WordPress

 

$100 Off My WooCommerce Development Workshop at WooConf 2016

Screen Shot 2016-03-05 at 10.36.22 PM.png

I’m super excited to head out to Austin on April 6-8 this year for my 2nd WooConf.  This year I will be doing a workshop based on a WooCommerce Theme Development Course I did at Treehouse.

Thanks to the folks at WooCommerce, I have an unlimited coupon code “WOOCONFZAC” for $100 off for anyone who wants to attend the conference for Woo work.

Check out the trailer for the course to get an idea of just some of what we will get into.

 

Of course we will also talk a little about JS and API work with WooCommerce 😉

How to Send Emails in WordPress from the Functions.php

I have been working on a project that needs to occasionally send off emails. If you need to do so, here’s how with wp_mail():

add_filter(‘wp_mail_content_type’,create_function(”, ‘return “text/html”; ‘));
wp_mail(‘whoever@whatever.com’, ‘Subject’, ‘Message’);

Thanks to WordPress Cheat Sheets for the code!