Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <?php get_header();?>
  2.  
  3. <?php $slug = basename(get_permalink()); ?>
  4. <?php while (have_posts()) : the_post(); ?>
  5. <?php if(is_page($slug)) : ?>
  6. <?php get_template_part("template-parts/component", $slug ) ?>
  7. <?php endif; ?>
  8. <?php endwhile; ?>
  9.  
  10. <?php get_footer(); ?>
  11.  
  12. <?php
  13. $args = array(
  14. 'post_type' => 'teste',
  15. );
  16. query_posts($args);
  17. ?>
  18. <div class="container">
  19. <h1><a href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a> </h1>
  20. <?php if(have_posts()): while(have_posts()): the_post(); ?>
  21. <a href="<?php the_permalink(); ?>" title="<?php echo the_title(); ?>"><?php echo the_title(); ?></a><br>
  22. <?php endwhile; endif;?>
  23. </div>
  24. <?php wp_reset_query();?>
  25.  
  26. if (!function_exists('teste')) {
  27.  
  28. function teste()
  29. {
  30. $labels = array(
  31. 'name' => 'Testes',
  32. 'singular_name' => 'Teste',
  33. 'menu_name' => 'Testes',
  34. 'parent_item_colon' => 'Testes',
  35. 'all_items' => 'Todos os Testes',
  36. 'view_item' => 'Ver Testes',
  37. 'add_new_item' => 'Adicionar nova teste',
  38. 'add_new' => 'Novo teste',
  39. 'edit_item' => 'Editar teste',
  40. 'update_item' => 'Atualizar teste',
  41. 'search_items' => 'Produto',
  42. 'not_found' => 'Nenhum teste encontrado',
  43. 'not_found_in_trash' => 'Nenhum teste encontrado na lixeira',
  44. );
  45.  
  46. $rewrite = array(
  47. 'slug' => 'teste',
  48. 'with_front' => true,
  49. 'pages' => true,
  50. 'feeds' => false,
  51. );
  52.  
  53. $args = array(
  54. 'label' => 'Testes',
  55. 'description' => 'Testes',
  56. 'labels' => $labels,
  57. 'supports' => array('title', 'thumbnail','editor'),
  58. 'taxonomies' => array(),
  59. 'hierarchical' => true,
  60. 'public' => true,
  61. 'show_ui' => true,
  62. 'show_in_menu' => true,
  63. //puxar o posttype para o menu e criar a sub sessão
  64. 'show_in_nav_menus' => true,
  65. 'show_in_admin_bar' => true,
  66. 'menu_position' => 6,
  67. 'menu_icon' => 'dashicons-plugins-checked',
  68. 'can_export' => true,
  69. 'has_archive' => false,
  70. 'exclude_from_search' => false,
  71. 'publicly_queryable' => true,
  72. 'query_var' => 'teste',
  73. 'rewrite' => $rewrite,
  74. 'capability_type' => 'post',
  75. );
  76. register_post_type('teste', $args);
  77. }
  78.  
  79. add_action('init', 'teste');
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement