- Status
- Resolved by author
- Reported for
- WPML Multilingual CMS 4.5.14
- Resolved in
- Astra 3.9.4
- Related plugin/theme
- Astra
- Topic tags
- Compatibility
Overview of the issue
Astra theme allows you to enable Custom Layouts from its options page. However, with the with its latest 3.9.3 release, any script added in the header or footer does not get loaded when using that feature.
Workaround
There are two workarounds you can try. Before proceeding with either, be sure to make a full backup.
Workaround 1
- Open /wp-content/plugins/astra-addon/classes/modules/target-rule/class-astra-target-rules-fields.php. file
- Look for line 1306.
- Replace:
if ( class_exists( 'SitePress' ) ) { global $sitepress; $check_wpml = true; $current_language = $sitepress->get_current_language(); $wpml_translate_query = "INNER JOIN {$wpdb->prefix}icl_translations as icl ON pm.post_id = icl.element_id"; $wpml_translate_query_condition = "AND icl.language_code = '{$current_language}'"; }
With:if ( class_exists( 'SitePress' ) ) { global $sitepress; $cpt_translation_mode = apply_filters( 'wpml_sub_setting', false, 'custom_posts_sync_option', 'astra-advanced-hook' ); if ( $cpt_translation_mode != false ) { $check_wpml = true; $current_language = $sitepress->get_current_language(); $wpml_translate_query = "INNER JOIN {$wpdb->prefix}icl_translations as icl ON pm.post_id = icl.element_id"; $wpml_translate_query_condition = "AND icl.language_code = '{$current_language}'"; } }
Workaround 2
- Go to WPML → Settings → Post Type Translation.
- Switch the astra-advanced-hook post type to Translatable – use translation if available or fallback to default languageand Save.
- Switch back to Not Translatable and Save.