تخطي الملاحة

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>