דלג על ניווט

Open

Topic Tags: Compatibility

Overview of the issue

In Tutor LMS, the Courses Archive Page is not correctly translated. While the static page can be translated, the translated page is not properly assigned in the backend. This leads to an incorrect URL being generated by the language switcher, pointing to an auto-generated slug instead of the expected URL.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

Part 1

  • Open the …/wp-content/plugins/tutor/classes/Template.php file.
  • Look for line 103.
  • Replace:
    $selected_archive_page = (int) tutor_utils()->get_option( 'course_archive_page' );
    
    if ( $page_id === $selected_archive_page ) {
    
  • With:
    $selected_archive_page = (int) tutor_utils()->get_option( 'course_archive_page' );
    
    // WPML Workaround for compsupp-7650 | Part 1
    $selected_archive_page = apply_filters( 'wpml_object_id', $selected_archive_page, get_post_type($selected_archive_page), true );
    
    if ( $page_id === $selected_archive_page ) {
    

Part 2

  • Open …/wp-content/plugins/tutor/classes/Utils.php file.
  • Replace:
    if ( $course_archive_page && '-1' !== $course_archive_page ) {
    	$course_page_url = get_permalink( $course_archive_page );
    }
    
  • With:
    if ( $course_archive_page && '-1' !== $course_archive_page ) {
    	
    	// WPML Workaround for compsupp-7650 | Part 2
    	$course_archive_page = apply_filters( 'wpml_object_id', $course_archive_page, get_post_type($course_archive_page), true );
    	
    	$course_page_url = get_permalink( $course_archive_page );
    }
    

Part 3

  • Go to WPML > Settings page.
  • Scroll down to the Post Type section.
  • Translate the archive course slug.

השאר מענה

אנא הישארו בנושא והיו מכבדים לאחרים. אם אתה צריך עזרה בבעיות שאינן קשורות לפוסט הזה, השתמש בפורום התמיכה שלנו כדי להתחיל צ'אט או לשלוח כרטיס.

תוכל להשתמש בתגים הבאים:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>