How to Hide the Course Difficulty in OSCampus

Hiding a course difficulty level in OSCampus

One of our OSCampus customers asked how to remove a course difficulty from a course and a pathway frontend pages.

In this tutorial, you will learn how to achieve this with a powerful set-and-forget technique called "template overrides".

At the end of this lesson, you will be able to edit a couple of the OSCampus core files even you know nothing about coding.

What is Joomla template overrides?

Joomla "Template overrides" is a powerful technique. It allows any beginner to customize layouts of their Joomla site pages.

You may already know that layouts of your Joomla pages are determined by your Joomla template.

Creating a template override for a component of your choice, you, in essence, create a sub-template for this component.

The process is simple:

  1. Select for which of your Joomla templates you would like to create an override.
  2. Select for which component (or module) you wish to create this override.
  3. Select for which layout of this component you wish to create this override.
  4. Edit and save the layout file to achieve the desired result.

Creating this template override, you keep your main template intact. You also keep your selected component's core files intact. 

But instead of your main template, it is now this template override controls the selected layout of your selected component.

How do I use template overrides to hide a course difficulty from a course frontend page?

As you are now empowered with the knowledge of the template overrides concept, let's put it into practice. 

Let's use it to remove an OSCamputs course difficulty level from a course frontend page.

A course difficulty level is a required setting for every course you create.

Accordingly, your OSCampus course frontend page will include it by default:

Course layout with difficulty level displayed

At the end of this tutorial, the course page won't include it:

Course layout without difficulty level displayed

  • Go to Extensions > Templates > Templates:

Extensions templates templates

  • You will be taken to the Templates: Templates (Site) page. It lists all the templates installed on your site. Find your template and click on <your_template> Details and Files. For the purpose of this tutorial, I selected the Js_wright template:

Select your template

  • You will see the Templates: Customise (<your_template>) screen. Under the Components column, click com_oscampus > course:

Click com oscampus course

  • You will see the message, notifying you that your template override has been created:

Message override created

  • Click html > com_oscampus > course > default.php:

Click html com oscampus course default php

  • Inside the default.php file, around line 43, delete the following code:


<?php echo JText::_('COM_OSCAMPUS_COURSE_LABEL_LEVEL'); ?>


<?php echo JText::_('COM_OSCAMPUS_DIFFICULTY_' . $this->course->difficulty); ?>


08 find this code

  • Click Save or Save & Close.

There you have it. If you now check your course frontend page, you will see that it doesn't display the course difficulty level anymore.

How do I use template overrides to remove a course difficulty from a pathway frontend page?

You remove a course difficulty level from a pathway frontend page the same way you just removed it from a course frontend page.

Use familiar to you now Joomla's Template Overrides technique.

Repeat the steps described above to create a template override. This time, though, create a template override for com_oscampus > pathway:

pathway template override

  • Click html > com_oscampus > pathway > default.php:

Click html then com_oscampus then pathway then default.php

  • In the default.php, on line 36, find echo OscampusLayoutHelper::render('course', $item);
  • Replace it with echo OscampusLayoutHelper::render('course', $item, '', array('difficulty' => false));
  • Click Save or Save & Close.

Excellent! If you check your pathway frontend page, you'll see that it doesn't display the course difficulty level anymore:

the pathway frontend page without course difficulty

What's Next?

Join our Joomlashack Everything Club now. Become a member and find everything you need to build great Joomla websites:

  • 22 powerful extensions
  • 20 beautiful templates
  • 500+ easy to follow training videos
  • 2 best-selling Joomla books.

About the author

Born from a Ukrainian mother and Russian father, Alex lives in the United Kingdom. Alex is a self-taught Microsoft Certified Professional. He enjoys learning Joomla and helping web site administrators make the most of it.