CoursePress hooks

I am building a website out with CoursePress, and I am looking at the Academy for inspiration. I notice that when you go to the main course page, it redirects to the Units page. Is there a setting in CoursePress for this, or was this custom coded?
Is there a way to hook into this?

  • mediastead

    This is only part of the conversation I had with support earlier today, and is not accurately describing my issue.

    The way CoursePress is currently working, I create a course, and there is a main course page, and then there is a "Units" page.

    The way the Academy is set up, there is no "main page" ... if you click on the "main page link" it actually redirects to the "units" page. When this happens, the units page on the Academy website has all of the information that is currently included in the standard CoursePress install on the main course page (summary, video, course structure, etc).

    I also currently have a support ticket out about how the units page isn't displaying the course structure properly. Instead of having all of the expanded modules visible, it only show the title of each main unit, and not all of the modules under each unit. The reason I am mentioning this is because I feel that the units page is an unnecessary page. The was WPMUDEV Academy is set up is how CoursePress should work. There's no reason to break the course structure out into another page, since it is already on the main course page. Just use the main course page as the units page.

    It seems you guys agree, because the Academy has is working the way it should be for everyone.

    So, long story short ... how can I make this happen?

    Thank you.

  • Sohag Ronjon Dey

    Hi mediastead,

    Thanks for contacting and I hope you are having a beautiful day. :slight_smile:

    For loading the units archive instead of the course defaults page you can try the following.

    1. Create a single-course.php file in your current active theme directory if you do not have one already. You can do that by copying the single.php of your active theme or by copying the single-course.php from this directory


    2. Add this code at the top in the single-course.php just before get_header()

    if ( CoursePress_Data_Student::is_enrolled_in_course( get_current_user_id(), get_the_ID() ) ) {
    			wp_safe_redirect( get_permalink( $course_id )."units" );

    this will open the units archive page. To add the description, videos, image etc to the units archive page you need to copy the archive-unit.php and content-course-overview.php from this directory
    wp-content\plugins\coursepress\2.0\themes\coursepress to your active themes directory and after that add the following code into the archive-unit.php to the area where you like the description, image or video to appear

    get_template_part( 'content-course-overview', 'single' );

    Please check the attached files as an example.

    Please also change the style of those pages according to your themes style and tweak them according to your need.

    Hope this helps.

    Please let us know if you need any further help.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.