I created a custom post type
function faq_func() {
$labels = array(
'name' => _x( 'FAQs', 'Post Type General Name', 'rrrrr' ),
'singular_name' => _x( 'FAQ', 'Post Type Singular Name', 'rrrrr' ),
'menu_name' => __( 'FAQ', 'rrrrr' ),
'parent_item_colon' => __( 'Parent Item:', 'rrrrr' ),
'all_items' => __( 'All Items', 'rrrrr' ),
'view_item' => __( 'View Items', 'rrrrr' ),
'add_new_item' => __( 'Add New', 'rrrrr' ),
'add_new' => __( 'New Item', 'rrrrr' ),
'edit_item' => __( 'Edit Item', 'rrrrr' ),
'update_item' => __( 'Update Item', 'rrrrr' ),
'search_items' => __( 'Search Item', 'rrrrr' ),
'not_found' => __( 'No items found', 'rrrrr' ),
'not_found_in_trash' => __( 'No items found in Trash', 'rrrrr' ),
);
$rewrite = array(
'slug' => 'faq',
'with_front' => true,
'pages' => false,
'feeds' => false,
);
$args = array(
'label' => __( 'faqs', 'rrrrr' ),
'description' => __( 'FAQ Page', 'rrrrr' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => get_bloginfo('template_directory').'/images/faq-icon.png',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'query_var' => 'faq',
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'faqs', $args );
}
add_action( 'init', 'faq_func', 0 );
And a archive-faqs.php file:
<?php get_header(); ?>
<?php
$args = array( 'post_type' => 'faqs' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;
?>
<?php get_footer(); ?>
The problem is that my items not visible on the page. Where is the problem?
UPDATE: I found the solution on wordpress.org:
Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type. To do this, go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure.