{"id":10481494,"date":"2018-07-10T19:26:58","date_gmt":"2018-07-10T19:26:58","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/parent-image\/"},"modified":"2018-07-10T19:26:58","modified_gmt":"2018-07-10T19:26:58","slug":"parent-image","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/parent-image\/","title":{"rendered":"Parent Image"},"content":{"rendered":"<p>Hi there,<br \/>\nThe code below returns a list of [posts] Parent category titles which works.<br \/>\nWhat I can&#8217;t figure out is how to add the thumbnail (but I&#8217;ll take any size) image for each one.<br \/>\nIt&#8217;s probaly simple but I can&#8217;t figure it out.<br \/>\nMany thanks<\/p>\n<pre><code>&lt;?php\n\/* template name: ParentCatTemplate *\/\nget_header(); ?&gt;\n    &lt;?php\n\/\/ get_categories() function will return all the categories\n     $upaae_categories = get_categories( array(  &#039;orderby&#039; =&gt; &#039;name&#039;,  &#039;order&#039; =&gt; &#039;ASC&#039; ) ); \n          foreach( $upaae_categories as $single_cat ) {  if($single_cat-&gt;parent &lt; 1) \n          \/\/ Display if parent category and exclude child categories  \n              {$category_link = sprintf( &#039;&lt;a href=&quot;%1$s&quot; alt=&quot;%2$s&quot;&gt;%3$s&lt;\/a&gt;&#039;, esc_url( get_category_link( $single_cat-&gt;term_id ) ),  \n              esc_attr( sprintf( &#039;View all posts in %s&#039;, &#039;textdomain&#039; ), $single_cat-&gt;name ),  esc_html( $single_cat-&gt;name ));  \n            echo \n             sprintf( $category_link ).&#039;&lt;\/br&gt;&#039;;  } } \n    ?&gt;\n&lt;?php get_footer(); ?&gt;\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-10481494","topic","type-topic","status-publish","hentry","topic-tag-images","topic-tag-parent"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10481494","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\/10481494\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10481494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}