Title: single-cpt.php and content-cpt.php aren&#039;t taking affect over single.php
Last modified: September 1, 2016

---

# single-cpt.php and content-cpt.php aren't taking affect over single.php

 *  Resolved [csjWP](https://wordpress.org/support/users/csjwp/)
 * (@csjwp)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/single-cptphp-and-content-cptphp-arent-affect-over-singlephp/)
 * Hi all,
    I must have stared myself blind. I know I’ve done this before, but now
   it isn’t working and I can’t tell why. It seems by the book to me… (But it is
   not!)
 * I’ve created a custom post type. And it shows up in the dashboard, and I’ve added
   some dummy text and saved my permalinks. Test viewed the post, it works and the
   slug is right. (Apologies some of the $labels and $args text is in Danish).
 *     ```
       /*----------------------------------------------------------------------------*/
       /* Custom Post Types and Taxonomies */
       /*----------------------------------------------------------------------------*/
       /**
        * cubo_portfolio Post Type
        */
       class cubo_portfolio {
   
       	function cubo_portfolio() {
       		add_action('init',array($this,'create_post_type'));
       	}
   
       	function create_post_type() {
       		$labels = array(
       		    'name' => 'Portfolio',
       		    'singular_name' => 'Portfolio',
       		    'add_new' => 'Tilføj nyt',
       		    'all_items' => 'Alle projekter',
       		    'add_new_item' => 'Tilføj nyt projekt',
       		    'edit_item' => 'Rediger projekt',
       		    'new_item' => 'Nyt portfolio projekt',
       		    'view_item' => 'Vis projekt',
       		    'search_items' => 'Søg projekter',
       		    'not_found' =>  'Ingen projekter fundet',
       		    'not_found_in_trash' => 'Ingen projekter fundet i papirkurven',
       		    'parent_item_colon' => 'Forælder post:',
       		    'menu_name' => 'Portfolio'
       		);
       		$args = array(
       			'labels' => $labels,
       			'description' => "Alle projekter og byggerier",
       			'public' => true,
       			'exclude_from_search' => true,
       			'publicly_queryable' => true,
       			'show_ui' => true,
       			'show_in_nav_menus' => true,
       			'show_in_menu' => true,
       			'show_in_admin_bar' => true,
       			'menu_position' => 5,
       			'menu_icon' => 'dashicons-portfolio',
       			'capability_type' => 'post',
       			'hierarchical' => false,
       			'supports' => array('title','editor','thumbnail'),
       			'has_archive' => true,
       			'rewrite' => array('slug' => 'portfolio', 'with_front' => 'before-portfolio'),
       			'query_var' => true,
       			'can_export' => true
       		);
       		register_post_type('cubo_portfolio',$args);
       	}
       }
   
       $cubo_portfolio = new cubo_portfolio();
       ```
   
 * Next step too make a duplicate of `single.php` and rename it to `single-portfolio.
   php`. Samething with `content.php` in my template-parts folder, rename it to `
   content-portfolio.php`. And link to it from `single-portfolio.php`
 *     ```
       get_template_part( 'template-parts/content', 'portfolio', get_post_format() );
       ```
   
 * But when I just try and echo out some random text to test that it is working.
   Nothing is showing up, but if I echo out the text in `single.php` it shows.
 * So I’m not targeting my new .php files. And I can’t spot the mistake, since I’m
   using the ‘slug’ I declared when registering the post type.
 * Can anyone spot the mistake? Thanks for the help.

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

 *  [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * (@girlieworks)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/single-cptphp-and-content-cptphp-arent-affect-over-singlephp/#post-7716160)
 * Hi, [@csjwp](https://wordpress.org/support/users/csjwp/). The post type which
   you actually registered is `cubo_portfolio`, so your `single-portfolio.php` file
   would need to be named `single-cubo_portfolio.php` instead.
 * (And while you could keep the template part file’s name as `content-portfolio.
   php` if you want, I recommend changing it to `content-cubo_portfolio.php` instead,
   just for the sake of consistency.)
 *  Thread Starter [csjWP](https://wordpress.org/support/users/csjwp/)
 * (@csjwp)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/single-cptphp-and-content-cptphp-arent-affect-over-singlephp/#post-7716165)
 * OMG! WOW, I’m speechless. Sometimes I just can’t see what is under my nose.
 * But thank you so much [@girlieworks](https://wordpress.org/support/users/girlieworks/)
   I really appreciate it.
 *  [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * (@girlieworks)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/single-cptphp-and-content-cptphp-arent-affect-over-singlephp/#post-7716224)
 * You’re welcome, [@csjwp](https://wordpress.org/support/users/csjwp/)! 🙂

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

The topic ‘single-cpt.php and content-cpt.php aren't taking affect over single.php’
is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/single-cptphp-and-content-cptphp-arent-affect-over-singlephp/#post-7716224)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
