Support » Fixing WordPress » Custom Post Type ONLY Working On index.php?

  • I have created a custom post type called ‘features’

    This all works fine, loads in admin can add posts to it, can print the post information but i cannot seem to link through to the single final page for each one.

    I have created a page in the admin with the template below.

    <?php
    /**
     * @package WordPress
     * @subpackage Starkers
     * @since testing 3.0
     */
    
     /*
     Template Name: Features
     */
    
    get_header(); ?>
    
    <?php get_template_part( 'includes/site-left' );?>
    
    <?php query_posts( array( 'post_type' => 'features' ) );?>
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
    
      <h2>
      <a href="<?php the_permalink() ?>"> <?php the_title(); ?></a>
     </h2>
    
      <?php the_content(); ?>
    
    <?php endwhile; endif;?>
    <?php wp_reset_query(); ?>
    
    <?php get_template_part( 'includes/site-right' );?>
    
    <?php get_footer(); ?>

    The plan being all the posts form features are displayed on that page, using that template.

    The content shows up fine however, there is a link to the individual post there, but the link is not showing up, so you cannot link through to the individual post.

    However, if i put the above code into index.php it works fine the link appears and you can link through.

    What am i doing wrong, surely you must be able to link through to an individual custom post type? I have the single-features.php page there to show it as well….

    Any ideas?

    Many thanks 🙂

  • The topic ‘Custom Post Type ONLY Working On index.php?’ is closed to new replies.