WPML
Trạng thái
Đã được giải quyết bởi nhà phát triển
Plugin/giao diện liên quan
Hestia Pro
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Nếu bạn đang sử dụng giao diện Hestia Pro, bạn có thể gặp sự cố bố cục Footer tùy chỉnh được tạo trong Giao diện > Custom layouts chỉ hiển thị bằng ngôn ngữ mặc định, bất kể các bản dịch có sẵn cho bố cục.

Giải pháp tạm thời

Vui lòng đảm bảo tạo một bản sao lưu đầy đủ cho trang web của bạn trước khi tiếp tục.


  • Mở tệp …/wp-content/themes/hestia-pro/inc/addons/modules/custom_layouts/class-hestia-custom-layouts-module.php.

  • Tìm dòng 210.

  • Thay đổi:
    	private function map_custom_layouts() {
    		if ( $this->is_builder_preview() ) {
    			return true;
    		}
    		$cache = get_transient( 'custom_layouts_posts_map' );
    		if ( ! empty( $cache ) ) {
    			self::$post_map = $cache;
    
    			return true;
    		}
    		$query = new WP_Query(
    			array(
    				'post_type'              => 'hestia_layouts',
    				'posts_per_page'         => 100,
    				'no_found_rows'          => true,
    				'update_post_meta_cache' => false,
    				'update_post_term_cache' => false,
    				'fields'                 => 'ids',
    				'post_status'            => 'publish',
    			)
    		);
    		if ( ! $query->have_posts() ) {
    			return false;
    		}
    		foreach ( $query->posts as $pid ) {
    			$layout   = get_post_meta( $pid, 'custom-layout-options-layout', true );
    			$priority = get_post_meta( $pid, 'custom-layout-options-priority', true );
    			if ( $layout === 'hooks' ) {
    				$layout = get_post_meta( $pid, 'custom-layout-options-hook', true );
    			}
    			self::$post_map[ $layout ][ $pid ] = $priority;
    		}
    		set_transient( 'custom_layouts_posts_map', self::$post_map, DAY_IN_SECONDS );
    
    		return true;
    	}

  • Thành:
    	private function map_custom_layouts() {
    		if ( $this->is_builder_preview() ) {
    			return true;
    		}
    
    		// Get the current language code
    		$current_language = apply_filters('wpml_current_language', NULL); // Fallback to WPML's current language
    
    		// Modify the transient key to include the current language
    		$wpml_transient_key = 'custom_layouts_posts_map_' . $current_language;
    
    		$cache = get_transient( $wpml_transient_key );
    		if ( ! empty( $cache ) ) {
    			self::$post_map = $cache;
    
    			return true;
    		}
    		$query = new WP_Query(
    			array(
    				'post_type'              => 'hestia_layouts',
    				'posts_per_page'         => 100,
    				'no_found_rows'          => true,
    				'update_post_meta_cache' => false,
    				'update_post_term_cache' => false,
    				'fields'                 => 'ids',
    				'post_status'            => 'publish',
    			)
    		);
    		if ( ! $query->have_posts() ) {
    			return false;
    		}
    		foreach ( $query->posts as $pid ) {
    			$layout   = get_post_meta( $pid, 'custom-layout-options-layout', true );
    			$priority = get_post_meta( $pid, 'custom-layout-options-priority', true );
    			if ( $layout === 'hooks' ) {
    				$layout = get_post_meta( $pid, 'custom-layout-options-hook', true );
    			}
    			self::$post_map[ $layout ][ $pid ] = $priority;
    		}
    		set_transient( $wpml_transient_key, self::$post_map, DAY_IN_SECONDS );		
    
    		return true;
    	}
  • Sau đó, xóa các transient của bạn.

Tất cả các lỗi đã ghi nhận →