{"id":10103387,"date":"2018-03-22T12:37:45","date_gmt":"2018-03-22T12:37:45","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/display-content-based-on-current-language-with-if-else\/"},"modified":"2018-03-22T12:47:04","modified_gmt":"2018-03-22T12:47:04","slug":"display-content-based-on-current-language-with-if-else","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/display-content-based-on-current-language-with-if-else\/","title":{"rendered":"Display content based on current language with IF\/ ELSE"},"content":{"rendered":"<p>Hello,<\/p>\n<p>how can you display content based on the current language (on a bilingual website)?<\/p>\n<p>I put this code from http:\/\/msls.co\/ in my child theme&#8217;s functions.php:<\/p>\n<pre><code>function switcheroo() {\n$blog     = MslsBlogCollection::instance()-&gt;get_current_blog();\n$language = $blog-&gt;get_language();\n}<\/code><\/pre>\n<p>And this in my footer.php:<\/p>\n<pre><code>&lt;?php\nif( switcheroo() == &#039;de_DE&#039; ){ ?&gt;\n&lt;!-- German content here--&gt;\nGerman content\n&lt;?php\n}else { ?&gt;\n&lt;!-- English content here--&gt;\nEnglish content\n&lt;?php }?&gt;<\/code><\/pre>\n<p>My ELSE rule works, <strong>but not the IF rule<\/strong>.<br \/>\nI guess the solution must be really obvious, but I&#8217;m a PHP newb, so I just don&#8217;t see it.<\/p>\n<p>Any help is appreciated.<\/p>\n<p>Thanks in advance.<\/p>\n","protected":false},"template":"","class_list":["post-10103387","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10103387","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\/10103387\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10103387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}