{"id":12165313,"date":"2019-11-22T20:05:07","date_gmt":"2019-11-22T20:05:07","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/extraordinary-13\/"},"modified":"2019-11-22T20:05:07","modified_gmt":"2019-11-22T20:05:07","slug":"extraordinary-13","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/extraordinary-13\/","title":{"rendered":"Extraordinary"},"content":{"rendered":"<p>Exactly what I was looking for ! Works great with the latest version of WordPress (5.3)<\/p>\n<p>No need for shortcode! To obtain a featured image that loads automatically according to the language of the plugin qtranslate-x, you can add in the file functions.php:<\/p>\n<pre><code>add_filter( &#039;kdmfi_featured_images&#039;, function( $featured_images ) {\n\t$args = array(\n\t  &#039;id&#039; =&gt; &#039;featured-image-en&#039;,\n\t  &#039;desc&#039; =&gt; &#039;English version of the feature image.&#039;,\n\t  &#039;label_name&#039; =&gt; &#039;English featured image&#039;,\n\t  &#039;label_set&#039; =&gt; &#039;Set english featured image&#039;,\n\t  &#039;label_remove&#039; =&gt; &#039;Remove english featured image&#039;,\n\t  &#039;label_use&#039; =&gt; &#039;Set english featured image&#039;,\n\t  &#039;post_type&#039; =&gt; array( &#039;page&#039;, &#039;post&#039;, &#039;portfolio&#039;, &#039;app&#039; ),\n\t);\n  \n\t$featured_images[] = $args;\n  \n\treturn $featured_images;\n  });\n\n  add_filter( &#039;get_post_metadata&#039;, &#039;wdm_change_featured_image&#039;, 10, 4 );\nfunction wdm_change_featured_image( $feature_image_id = null, $post_id, $meta_key, $single ) {\n    if ( $meta_key == &#039;_thumbnail_id&#039; ) {\n         if(function_exists(&#039;qtranxf_getLanguage&#039;)) {\n        if (qtranxf_getLanguage() == &#039;en&#039; &amp;&amp; kdmfi_has_featured_image( &#039;featured-image-en&#039;, $post_id )) {\n            $feature_image_id = kdmfi_get_featured_image_id( &#039;featured-image-en&#039;, $post_id );\n        }\n    }\n    }\n  return $feature_image_id;\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-12165313","topic","type-topic","status-publish","hentry","topic-tag-featured-image"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12165313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12165313\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12165313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}