General Section or first section of MOODLE course is important as it contains Announcement and other information of course. Although, some trainers or institute don’t find it very useful and want to remove this from courses. Removing first section i.e General Section from a MOODLE course is not possible without heavy programming but we can hide it easily using CSS. In this blog you will learn how to hide first section of MOODLE course using CSS. We are using MOODLE 4 and Boost theme, steps may vary from theme to theme and as per the version of MOODLE but concept will remain same.
Understanding HTML element structure of MOODLE course
Course sections are arranged as unordered list and each section is a list element in MOODLE’s html code. You can check element easily in any browser just by right clicking on any section and click on inspect on the menu as shown in the GIF below.
Clicking on inspect menu item opens devtools that shows that each section is a list element in an unordered list html element as shown in the image below.
Identify element id of first section of MOODLE course
In the devtools, we can see that first section of MOODLE course is the first list element and it has id “section-0”. As we know section id of first section we can easily hide it using CSS code.
CSS code to hide first section
Its easy to hide a CSS element using its id. In order to hide element with id section-0, CSS code will be
#section-0 {
display: none;
}
This code will work but just in case it doesn’t work you can include ul and li elements to hide first section. Updated code will be
ul.topics li#section-0 {
display: none;
}
Place CSS code in Boost Theme
Now we have CSS code that will hide first section of MOODLE course. The point is where to place it in MOODLE theme? In Boost Theme of MOODLE 4, we can place it in Raw SCSS text box available on advanced settings of Boost theme by following these steps:
visit Site administrator > Appearance > Theme
Click on settings gear of Boost theme.
Go to Advanced settings
Paste CSS code in Raw SCSS text box and save changes.
That’s all, if you followed this article, general section or first section of MOODLE course is no longer visible in all courses. Visit any course page to check if its true.
In case you are facing any issue or want to implement something more complex on your MOODLE LMS website. We can help, just let us know your requirements and we will implement it for you.