Guest User

Untitled

a guest
Nov 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <?php
  2. add_action('init', 'type_post_representantes');
  3.  
  4. function type_post_representantes() {
  5. $labels = array(
  6. 'name' => _x('Representantes', 'post type general name'),
  7. 'singular_name' => _x('Representantes', 'post type singular name'),
  8. 'add_new' => _x('Adicionar Novo', 'Novo item'),
  9. 'add_new_item' => __('Novo Item'),
  10. 'edit_item' => __(' Item'),
  11. 'new_item' => __('Novo Item'),
  12. 'view_item' => __('Ver Item'),
  13. 'search_items' => __('Procurar Itens'),
  14. 'not_found' => __('Nenhum registro encontrado'),
  15. 'not_found_in_trash' => __('Nenhum registro encontrado na lixeira'),
  16. 'parent_item_colon' => '',
  17. 'menu_name' => 'Representantes'
  18. );
  19.  
  20. $args = array(
  21. 'labels' => $labels,
  22. 'public' => true,
  23. 'public_queryable' => true,
  24. 'show_ui' => true,
  25. 'query_var' => true,
  26. 'rewrite' => true,
  27. 'capability_type' => 'post',
  28. 'has_archive' => true,
  29. 'hierarchical' => false,
  30. 'menu_position' => null,
  31. 'supports' => array('title','editor','thumbnail','comments', 'excerpt', 'custom-fields', 'revisions', 'trackbacks')
  32. );
  33.  
  34. register_post_type( 'representantes' , $args );
  35. flush_rewrite_rules();
  36. }
  37. ?>
  38. <?php
  39. register_taxonomy(
  40. "categorias",
  41. "representantes",
  42. array(
  43. "label" => "Categorias",
  44. "singular_label" => "Categoria",
  45. "rewrite" => true,
  46. "hierarchical" => true
  47. )
  48. );
  49. ?>
  50.  
  51. html:
  52.  
  53. <?php
  54. $newsArgs = array( 'post_type' => 'representantes', 'posts_per_page' => 30);
  55.  
  56. $newsLoop = new WP_Query( $newsArgs );
  57.  
  58. while ( $newsLoop->have_posts() ) : $newsLoop->the_post(); ?>
  59. <div class="representantes" style="display:block !important;"><!---blocos--->
  60. <?php the_taxonomies(array('template' => '% %l')); ?>
  61. <?php the_content(); ?>
  62. </div><!--FINAL BLOCO-->
  63. <?php endwhile; ?>
  64.  
  65. <?php the_taxonomies(array('template' => '% %l')); ?>
Add Comment
Please, Sign In to add comment