Listando post type nas categorias
-
Boa tarde galera,
Sou novo com wordpress e estou tendo dificuldade com o famoso Post Type. Registrei um novo tipo de post mais ele não é listado no nas categorias, apenas os posts normais.
add_action( 'init', 'type_post_projetos' ); function type_post_projetos() { $labels = array( 'name' => _x('Portfólio', 'post type general name'), 'singular_name' => _x('Projeto', 'post type singular name'), 'add_new' => _x('Adicionar Novo', 'Novo item'), 'add_new_item' => __('Novo Projeto'), 'edit_item' => __('Editar Projeto'), 'new_item' => __('Novo Projeto'), 'all_items' => __('Todos os Projetos'), 'view_item' => __('Ver Projeto'), 'search_items' => __('Procurar Itens'), 'not_found' => __('Nenhum registro encontrado'), 'not_found_in_trash' => __('Nenhum registro encontrado na lixeira'), 'parent_item_colon' => '', 'menu_name' => 'Projetos' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'show_admin_column' => true, 'rewrite' => array('slug' => 'portfolio','with_front' => false), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title','editor','thumbnail','comments', 'excerpt', 'custom-fields', 'revisions', 'trackbacks', 'page-attributes'), 'taxonomies' => array( 'category', 'post_tag', 'wo_plataforma' ), 'query_var' => 'projetos', 'label' => 'Projetos', 'can_export' => true, ); register_post_type( 'projetos' , $args ); flush_rewrite_rules(); }
Meu loop de repetição está assim
<?php while (have_posts('projetos')) : the_post(); ?> <div class="col-lg-3 col-md-4 col-sm-6 projeto-bloco"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_post_thumbnail('post-thumbnail', array( 'class' => "img-responsive")); ?> <div class="title-project margin-tp-small"> <h3 class="margin-tp-small margin-bt-zero"><?php the_title(); ?></h3></a> <p class="margin-tp-zero"><?php the_category(',') ?> <?php echo strip_tags(get_the_tag_list('',' • ',''));?>.</p> </div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?>
Alguém consegue me ajudar?
Visualizando 3 respostas - 1 até 3 (de um total de 3)
Visualizando 3 respostas - 1 até 3 (de um total de 3)
- O tópico ‘Listando post type nas categorias’ está fechado para novas respostas.