{"id":975,"date":"2009-04-12T17:52:45","date_gmt":"2009-04-12T17:52:45","guid":{"rendered":"https:\/\/br.wordpress.org\/support\/topic\/filtrar-posts-da-home-page-com-custom-fields\/"},"modified":"2016-08-06T01:06:52","modified_gmt":"2016-08-06T01:06:52","slug":"filtrar-posts-da-home-page-com-custom-fields","status":"closed","type":"topic","link":"https:\/\/br.wordpress.org\/support\/topic\/filtrar-posts-da-home-page-com-custom-fields\/","title":{"rendered":"Filtrar posts da home page com custom fields?"},"content":{"rendered":"<p>Estou com uma duvida.<br \/>\nEu estou querendo filtrar os posts que ser\u00e3o exibidos na home page atrav\u00e9s de custom fields. Ou seja, sempre que eu o custom field retornar &#8220;false&#8221; o post ser\u00e1 exibido, por\u00e9m, se ele retornar &#8220;True&#8221; , o post ser\u00e1 exclu\u00eddo da home page.<\/p>\n<p>Primeiramente fiz assim:<\/p>\n<p>&lt;?php while(have_posts()):the_post();?&gt;<br \/>\n&lt;?php $post_exibe = get_post_meta($post-&gt;ID, post_exibe,true);<br \/>\nif ($post_exibe == false){;?&gt;<\/p>\n<p>conteudo do loop<\/p>\n<p>&lt;?php }?&gt;<br \/>\n&lt;?php endwhile;?&gt;<\/p>\n<p>No c\u00f3digo acima, o loop exibe os posts, e se houver algum post que tenha o custom field &#8220;post_exibe&#8221; preenchido, este post ser\u00e1 exclu\u00eddo da home page. <\/p>\n<p>Funcionou at\u00e9 certo ponto. Pois fazendo isso, a pagina\u00e7\u00e3o da erro&#8230; O loop n\u00e3o funciona corretamente.<\/p>\n<p>Algu\u00e9m pode me ajudar?<\/p>\n","protected":false},"template":"","class_list":["post-975","topic","type-topic","status-closed","hentry","topic-tag-listagem","topic-tag-pagina-inicial"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/975","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\/975\/revisions"}],"wp:attachment":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}