{"id":60928,"date":"2016-06-08T17:31:37","date_gmt":"2016-06-08T17:31:37","guid":{"rendered":"https:\/\/br.wordpress.org\/support\/topic\/thumbnails-em-custom-post-types-nao-funcionam\/"},"modified":"2016-08-06T01:46:54","modified_gmt":"2016-08-06T01:46:54","slug":"thumbnails-em-custom-post-types-nao-funcionam","status":"publish","type":"topic","link":"https:\/\/br.wordpress.org\/support\/topic\/thumbnails-em-custom-post-types-nao-funcionam\/","title":{"rendered":"Thumbnails em Custom Post Types n\u00e3o funcionam"},"content":{"rendered":"<p>Tentei adicionar Thumbnails em um Custom Post Type mas nem funciona.<br \/>\nAlgu\u00e9m j\u00e1 passou por isso e sabe resolver? Segue c\u00f3digo. VLW<\/p>\n<p>FUNCTIONS<\/p>\n<pre><code>add_action( &#039;init&#039;, &#039;create_post_type&#039; );\nfunction create_post_type() {\n  register_post_type( &#039;eventos&#039;,\n\tarray(\n\t  &#039;labels&#039; =&gt; array(\n\t\t&#039;name&#039; =&gt; __( &#039;Eventos&#039; ),\n\t\t&#039;singular_name&#039; =&gt; __( &#039;Eventos&#039; )\n\t  ),\n\t  &#039;public&#039; =&gt; true,\n\t)\n  );\n\n}\n\nregister_taxonomy(\n&quot;categorias&quot;,\n\t  &quot;eventos&quot;,\n\t  array(\n\t\t&quot;label&quot; =&gt; &quot;Categorias&quot;,\n\t\t\t&quot;singular_label&quot; =&gt; &quot;Categoria&quot;,\n\t\t\t&quot;rewrite&quot; =&gt; true,\n\t\t\t&quot;hierarchical&quot; =&gt; true\n)\n);\n\nadd_theme_support( &#039;post-thumbnails&#039;, array( &#039;post&#039;, &#039;eventos&#039; ) );<\/code><\/pre>\n<p>CHAMANDO O POST<\/p>\n<pre><code>&lt;?php $newsArgs = array( &#039;post_type&#039; =&gt; &#039;eventos&#039;, &#039;posts_per_page&#039; =&gt; 18);\n\t\t\t\t$newsLoop = new WP_Query( $newsArgs );\n\t\t\t\twhile ( $newsLoop-&gt;have_posts() ) : $newsLoop-&gt;the_post();?&gt;\n\n\t\t\t\t&lt;div class=&quot;one-fourth&quot;&gt;\n\t\t\t\t    &lt;h1&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/h1&gt;\n\t\t\t\t&lt;\/div&gt;\n\n\t\t\t&lt;?php endwhile; ?&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-60928","topic","type-topic","status-publish","hentry","topic-tag-custom-post-types","topic-tag-thumbnails"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/60928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/60928\/revisions"}],"wp:attachment":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=60928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}