Title: Custom Post Types, the single-.php problem
Last modified: August 19, 2016

---

# Custom Post Types, the single-.php problem

 *  [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * (@christhesoul)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/)
 * Hi
 * I’m trying to use WordPress custom post types. I’ve read lots of tutorials and
   finally dived in.
 * I’ve created a custom post type called a ‘project’.
 * All was going swimmingly until I tried to create single-project.php to display
   single projects pages. I’ve uploaded this file to my theme directory, but nothing
   seems to work. (I can display all projects by manipulating query_posts). It’s
   just this tiny element of things that won’t work!
 * Is there something else I need to do to ensure this works to single-project.php
   to work?
 * Thanks for your help
    Chris

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720633)
 * The single-project file is only for displaying singular entries, so if you want
   something that lists all the projects you’ll need to create a page do that…
 * Generally the easiest route to doing that is using a page template attached to
   a page that fetches posts with the custom post type..
    ** NOTE/TIP: Don’t name
   the page “Project”, give it a plural, so “Projects” … else the rewrite rules 
   for your page and custom post type entries (the singular ones) will conflict 
   with one another.
 *  Thread Starter [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * (@christhesoul)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720644)
 * Hi Mark
 * Thanks for replying – I’m actually trying to create a single page.
 * I’ve created a page with all the projects, no problem at all. When I click through,
   though, I just get a ‘page not found’ error, despite having single-project.php
   in my themes folder.
 *  Thread Starter [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * (@christhesoul)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720646)
 * Here’s my code, if that helps.
 *     ```
       //Register projects
   
       add_action('init', 'project_register');
   
       function project_register() {
           $args = array(
               'label' => __('Projects'),
               'singular_label' => __('Project'),
               'public' => true,
               'show_ui' => true,
               'publicly_queryable' => true,
               'query_var' => true,
               'capability_type' => 'post',
               'hierarchical' => false,
               'rewrite' => true,
               'supports' => array('title', 'editor','excerpt')
           );
           register_post_type('project', $args );
       }
       ```
   
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720647)
 * What’s the URL you see when you get page not found?
 * It should be `example.com/project/your-project-name` (additionally including 
   the directory if WP is installed in a directory)..
 * If you have permalinks setup in a way that adds additional data to the front 
   of permalinks you’ll need to set `with_front` to false when you registering the
   post type…
 * See the rewrite parameter on this page in regard to `with_front`.
    [http://codex.wordpress.org/Function_Reference/register_post_type](http://codex.wordpress.org/Function_Reference/register_post_type)
 * **NOTE:** If you need to make that change to the post type registration code 
   then you’ll also need to save your permalink settings afterwards in order for
   the rules to get regenerated (simply visit the permalink settings page and hit
   save).
 *  Thread Starter [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * (@christhesoul)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720696)
 * Hi Mark
 * Thanks for your reply.
 * Yes, that’s exactly what should’ve happened. I revisited the permalinks the page
   was creating within the post area, and they seemed correct. So I tried to ‘preview’
   the page, and sure enough it worked.
 * I then went back to my original page and tried the clickthrough to the page that
   should call this template. And this time it worked.
 * I have no idea what’s happened here. All I know is that it certainly didn’t work,
   and now it does. Which is perhaps just as frustrating, as I can’t imagine that
   previewing a page would have any affect whatsoever.
 * Oh well, all’s well that works properly.
 * Thanks again
    Chris
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720699)
 * Strange, but glad to hear it’s all working for you now.. 😉
 *  Thread Starter [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * (@christhesoul)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720949)
 * I’ve been reading more about custom post types over the last few days.
 * I’ve read elsewhere that simply visiting the permalinks page can fix this problem.
   So perhaps that’s what I did.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Custom Post Types, the single-.php problem’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [single](https://wordpress.org/support/topic-tag/single/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 7 replies
 * 2 participants
 * Last reply from: [christhesoul](https://wordpress.org/support/users/christhesoul/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/custom-post-types-the-single-php-problem/#post-1720949)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
