Course Structure not displaying all the units and page titles

Hi

I have created a course that has 10 units.

During testing I've discovered that only the first 6 units are displayed in the Course Overview.

Is there a setting to display all of the Units in the Course Structure?

And finally, when a student clicks on a link in the Course Structure is it possible to customize the message? It currently displays 'This Unit is not available at the moment. Please check back later.' I want to explain that its not available because the student hasn't completed the previous units.

Thank you

  • Vinod Dalvi

    Hi Tony,

    I hope you are well today and thank you for your question.

    Is there a setting to display all of the Units in the Course Structure?

    Please make sure you have selected all the units in the "Step 2 - Course Description" section as shown in the attached screenshot.

    And finally, when a student clicks on a link in the Course Structure is it possible to customize the message? It currently displays 'This Unit is not available at the moment. Please check back later.' I want to explain that its not available because the student hasn't completed the previous units.

    To change this try adding the following code in the functions.php file of your child theme.

    function change_translate_text_wpmu( $translated_text, $text, $domain ) {
    
    	if ( $domain == 'cp' && trim($translated_text) == 'This Unit is not available at the moment. Please check back later.' ) {
    		$translated_text = "The unit is not available because the student hasn't completed the previous units.";
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text_wpmu', 20, 3 );

    Best Regards,
    Vinod Dalvi

  • Tony

    Hi Vinod

    Course Structure is now displaying correctly - I had all the Units selected but had neglected to click the Update button. Thanks for help.

    I have a major issue with the code you provided for my second question about customizing the message when a student clicks on a unit they don't yet have access to - I copied the code you provided in the child functions.php file and got the following error message:

    Parse error: syntax error, unexpected ';', expecting '(' in /home/peacefu0/public_html/pponline/wp-content/themes/coursepress-child/functions.php on line 13

    The code in my child-theme functions.php file looks like this

    <?php
    /**
    * CoursePress child theme
    *
    */
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    function enqueue_parent_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    function change_translate_text_wpmu( $translated_text, $text, $domain ) {

    if ( $domain == 'cp' && trim($translated_text) == 'This Unit is not available at the moment. Please check back later.' ) {
    $translated_text = "The unit is not available because the student hasn't completed the previous units.";
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text_wpmu', 20, 3 );

    Hope you can help

  • Vinod Dalvi

    Hi Tony,

    Why have wrapped the code in the double quote?

    It should be like following.

    <?php
    /**
    * CoursePress child theme
    *
    */
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    function enqueue_parent_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    
    function change_translate_text_wpmu( $translated_text, $text, $domain ) {
    if ( $domain == 'cp' && trim($translated_text) == 'This Unit is not available at the moment. Please check back later.' ) {
    $translated_text = "The unit is not available because the student hasn't completed the previous units.";
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text_wpmu', 20, 3 );

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.