WPML

Overview of the Issue

When using the “Advanced Gallery” block from Kadence Blocks with WPML, media added to the gallery cannot be translated via the Media Translation module. Translated images do not appear on the secondary language pages.

Workaround

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

  • Open the …/wp-content/plugins/kadence-blocks/includes/blocks/class-kadence-blocks-advancedgallery-block.php file.
  • Look for line 1000.
  • Replace:
    PHP
    $image_id = ( ! empty( $image['id'] ) ? $image['id'] : '' );
  • With:
    PHP
    $image_id = ( ! empty( $image['id'] ) ? apply_filters( 'wpml_media_id', $image['id'] ) : '' );
  • Look for line 1021.
  • Replace:
    PHP
    $image_src  = ( ! empty( $image['thumbUrl'] ) ? $image['thumbUrl']  : $image['url']  );
  • With:
    PHP
    $image_src  = ( ! empty( $image['thumbUrl'] ) ? apply_filters( 'wpml_media_url', $image['thumbUrl'] ) : apply_filters( 'wpml_media_url', $image['url'] ) );

All known issues

Need Help with This Issue?

Ask a support question and we’ll look into it with you.