跳过导航

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.

留下回复

紧扣主题并尊重他人。如果您需要帮助解决与本帖无关的问题,请使用我们的 Support Forum 开始聊天或提交票据。

您可以使用这些标签:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>