Page templates in CoursePress Pro

I'd like to use my full-width template (no sidebars) for my courses in CoursePress Pro. I don't see how in the settings or tutorial instructions to make this change. How can I achieve this?

  • Adam Czajczyk

    Hello Sarah,

    I hope you're well today and thank you for your question!

    Our "CoursePress" plugin is using "virtual pages" by default so there's no option to assign a template to such pages "out of the box". The workaround here is to create a custom page template.

    All the courses are in fact custom posts of "course" type. This means that you could

    1. Create a child theme of your current theme:

    https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    2. Copy "full width" page template file from your current theme folder to the folder of your new child theme

    3. rename it to "single-course.php"

    4. In your dashboar on "Appearance -> Themes" page switch to your new child theme.

    From now on nothing should be changed on your site except that the CoursePress should pick up full width template instead of default one.

    I hope that helps!
    Best regards,
    Adam

  • Predrag Dubajic

    Hi Sarah,

    Apologies for the delay here.

    I checked your site and the theme looks pretty simple so we might be able to do this change with some simple CSS adjustments.

    Could you undo the changes you made (remove modified files) and revoke support access and then grant it again, this second part is because I keep getting error trying to access your site.

    We can then check your course pages and provide you with correct code to use.

    Best regards,
    Predrag

    • Adam Czajczyk

      Hello menno,

      There's a couple of ways you can customize that.

      1. If you go to "CoursePress Pro -> Settings -> General Settings" page you will notice that there are pages for which you can select whether "virtual page" should be used or not. If you don't use virtual page you can select a real page (that you create in "Pages" section of your WP back-end) to be used for given part of CoursePress. And for these pages you can assign templates that are available in your theme (or custom added by you) just like to any other regular WP page.

      2. For virtual pages, simpler/minor changes would preferably be done using CSS (a lot can be achieved that way). You can, however, follow the WP template hierarchy and create your own templates. The principle would be the same as with creating any "regular" custom page template with a small difference with naming.

      Take a look at this handy chart chart here: https://wphierarchy.com/

      As shown, the most basic page template file is "page.php" but if "page-$id.php" exists (where $id is an actual number being an ID of the page you want to use template for), that one will be used. That, however, can again be overwritten by "page-$slug.php". So for example:

      - by default student login page is under "domain.com/student-login"
      - the slug here would be "student-login"
      - the custom template could be created as "page-student-login.php"

      So that should be working as well. You can check and set those slugs on "CoursePress Pro -> Settings -> General Settings" page.

      3) CoursePress is using posts and taxonomies of custom post type. Therefore, custom template files can be created for them too. You got post types:

      "course" for courses,
      "cp_certificate" for course certificates
      "discussions" for course discussions
      "module" for course modules (though in this case I don't see how a custom template could be used)
      "unit" for course units

      and taxonomy:

      "course_category" for course categories listings.

      Following the WordPress Template Hierarchy to which I linked to earlier, you should be able to customize the "look&feel" pretty deep.

      It's also worth to take a look at the generic CoursePress theme or maybe even build upon it. You will find it inside the plugin folder in "/wp-content/plugins/coursepress/2.0/themes/coursepress" folder.

      If you have any additional questions or need assistance, please join our live support chat here: https://premium.wpmudev.org/live-support/

      If it turns out that your question/case cannot be resolved during a chat session and it needs to be addressed via support ticket, we will start a separate support thread for you.

      Best regards,
      Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.