{"id":11663026,"date":"2019-06-22T16:01:46","date_gmt":"2019-06-22T16:01:46","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/conditionally-output\/"},"modified":"2019-06-22T16:28:38","modified_gmt":"2019-06-22T16:28:38","slug":"conditionally-output","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/conditionally-output\/","title":{"rendered":"conditionally output"},"content":{"rendered":"<p>I would like to show an image right with my excerpt. I am using  <\/p>\n<pre><code>&lt;p&gt;&lt;strong&gt; {title}&lt;\/strong&gt;&lt;\/p&gt;\n&lt;p&gt;{excerpt}&lt;\/p&gt;\n&lt;a href=&quot;{url}&quot; title=&quot;article link&quot;&gt;More ...&lt;\/a&gt;<\/code><\/pre>\n<p>For the image i would add <\/p>\n<p><code>&lt;a href=&quot;{url}&quot;&gt;&lt;img class=&quot;alignright&quot; src=&quot;{imagesrc}&quot; alt=&quot;{imagealt}&quot; width=&quot;250&quot; height=&quot;250&quot; \/&gt;&lt;\/a&gt;<\/code><\/p>\n<p>However I need to grab the image only if there is one in the post. Otherwise I have code without function in my html.<\/p>\n<p>Is there a solution for this with conditionally output (like documented here: http:\/\/rmarsh.com\/plugins\/post-options\/ ), or maybe another solution?<\/p>\n","protected":false},"template":"","class_list":["post-11663026","topic","type-topic","status-publish","hentry","topic-tag-image"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11663026","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":3,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11663026\/revisions"}],"predecessor-version":[{"id":11663058,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11663026\/revisions\/11663058"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11663026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}