Jump to content
Sign in to follow this  
Danny

How do I create a new single-{post-type}.php template ?

Recommended Posts

Danny    1,327
Danny

I am using the Easy Custom Content Type plugin and its having great difficulty in creating new template for my custom post types. Now I have spoken to the author of the plugin and he has even logged on my test site to investigate the error and he had this to say. "PageLines is one of those themes that has used unconventional methods in their theme development. Template creation will NOT work with this theme." To which I asked, is there some kind of function I could add or could I manually create the templates for the custom post types. He replied with this. "The template creation won't work because the function has to have a valid template to copy before it can create the template. It would be worth while to just ask them "how do I create a single-{post-type}.php template in my child theme?". The question really, is whether or not you can simply copy single.php over from the parent theme to the child theme without causing any problems." So thats my question, how do I resolve this? Danny


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon    247
Simon

Its easy to create a custom page and a section to use within the page template. We have no idea how the plugin populates the page template or what it wants to put in there as its a closed source plugin. I'm sure one of these guys would be happy to code you a section http://www.pagelines.com/pros/ Of course if the main theme needs to be changed at all we can release a revision no problem.

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Im actually speaking to the developer now, as he is on my test site going over a few things, so I'll ask him, how his plugin populates the template so hopefully we can get this issue resolved. As the plugin itself is amazing. Thanks for the reply also. Danny


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon    247
Simon

Send me the plugin if you like simon@pagelines.com

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

You got mail!


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Ok the plugin author as just got back to me and wrote this: "the plugin creates the templates based off of the already existing templates. It copies them to a new file and names them appropriately."


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon    247
Simon

hmm i got custom post types working without a plugin.

	add_action( 'init', 'register_cpt_book' );
	
	function register_cpt_book() {
	
	    $labels = array(
	        'name' => _x( 'books', 'book' ),
	        'singular_name' => _x( 'book', 'book' ),
	        'add_new' => _x( 'Add New', 'book' ),
	        'add_new_item' => _x( 'Add New book', 'book' ),
	        'edit_item' => _x( 'Edit book', 'book' ),
	        'new_item' => _x( 'New book', 'book' ),
	        'view_item' => _x( 'View book', 'book' ),
	        'search_items' => _x( 'Search books', 'book' ),
	        'not_found' => _x( 'No books found', 'book' ),
	        'not_found_in_trash' => _x( 'No books found in Trash', 'book' ),
	        'parent_item_colon' => _x( 'Parent book:', 'book' ),
	        'menu_name' => _x( 'books', 'book' ),
	    );
	
	    $args = array(
	        'labels' => $labels,
	        'hierarchical' => false,
	
	        'supports' => array( 'title', 'editor' ),
	
	        'public' => true,
	        'show_ui' => true,
	        'show_in_menu' => true,
	        'menu_position' => 5,
	
	        'show_in_nav_menus' => true,
	        'publicly_queryable' => true,
	        'exclude_from_search' => false,
	        'has_archive' => true,
	        'query_var' => true,
	        'can_export' => true,
	        'rewrite' => true,
	        'capability_type' => 'post'
	    );
	
	    register_post_type( 'book', $args );
		global $wp_rewrite;
		$wp_rewrite->flush_rules();
	}
	

now when i go to the admin there is a books section i can add book posts to. when i go to http:blog/book/ i get a list of my book posts and if i click them it goes to singular books. No need for custom templates. The next version promises to have more support for CPT's

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Yeah I have already done that before, but the plugin makes life a little easier, the main reason why I want to get this automatic creation of the single.post-type.php files is so I dont have to have a singular list of the custom post types. I appreciate you going to all that trouble but that really doesnt help me Pross unfortunately.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon    247
Simon

Not sure I understand what your after now, you want singular posts like /book1 /book2 /book3 etc but not the archive /books/ ?

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

No, basically, I have a custom post for Players of a Football teams squad, then I have a taxonomy for "Current Squad" and "Legends". Now the way I wanted to set it up was to have the archive of all the players in a different setup to the singular method used for posts. I was going to set it so that all players were present, similar to how it looks on here. http://www.manutd.com/en/Players-And-Staff/First-Team.aspx


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×