- Status
- Resolved by author
- Resolved in
- OceanWP 3.5.1
- Related plugin/theme
- OceanWP
- Topic tags
- Compatibility
Overview of the issue
If you are using OceanWP theme with WPML, you may encounter an issue where translated Library items are not display correctly on the frontend when retrieved via a shortcode (e.g., [oceanwp_library id=”52″]). This means that even if the library item has been translated within the OceanWP > Library section, the translated version doesn’t display as expected.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Add the following code into your theme’s functions.php file:
// WPML: Workaround for compsupp-7012 function wpml_compsupp7012_filter_oceanwp_library_shortcode( $out, $pairs, $atts ) { if ( class_exists('Sitepress') && isset( $out['id'] ) ) { $post_type = get_post_type($out['id']); $out['id'] = apply_filters( 'wpml_object_id', $out['id'], $post_type , TRUE ); } return $out; } add_filter( 'shortcode_atts_oceanwp_library', 'wpml_compsupp7012_filter_oceanwp_library_shortcode', 10, 3 );