Custom Post Types and single page
-
Hello,
i have big problem using custom post types. I managed to create custom post types and to show them on desired page template via this code<?php $type = 'ourteam'; $args = array( 'post_type' => $type, ); $my_query = null; $counter = 1; $my_query = new WP_Query($args); if ($my_query->have_posts()) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="slide slide<?php echo $counter++; ?>"> <?php my_excerpt('short'); ?> </div> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>Its loading correct data from ourteam. But when i click on read more link from excerpt it goes to page named by page title but it says page not found ? I named single-ourteam.php. But as i said problem is when i use link from excerpt it says NOT FOUND or dead page :/
also this is from functions.php
// Registers the new post type and taxonomy function wpt_ourteam_posttype() { register_post_type( 'ourteam', array( 'labels' => array( 'name' => __( 'Our Team' ), 'singular_name' => __( 'Our Team' ), 'add_new' => __( 'Add New Member' ), 'add_new_item' => __( 'Add New Member' ), 'edit_item' => __( 'Edit Member' ), 'new_item' => __( 'Add New Member' ), 'view_item' => __( 'View Member' ), 'search_items' => __( 'Search Member' ), 'not_found' => __( 'No Members found' ), 'not_found_in_trash' => __( 'No Members found in trash' ) ), 'public' => true, 'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ), 'capability_type' => 'post', 'rewrite' => array("slug" => "our-team"), // Permalinks format 'menu_position' => 20, ) ); } add_action( 'init', 'wpt_ourteam_posttype' );
The topic ‘Custom Post Types and single page’ is closed to new replies.