I have used custom post type to create 1 module products. And I want to display the article on which product module with POST TEMPLATE SITE is STYLE 2. So I have to edit somewhere?
In Post setting have 6 style: Default, style 1-5 –> I’d just created Module Products SITE TEMPLATE there is POST STYLE 2
This is the code I add product modules (functions.php):
This is demo: http://www.screencast.com/t/xYlFqL6I
function Creat_custom_post_type()
{
$label = array(
‘name’ => ‘Products’,
‘singular_name’ => ‘Product’
);
$args = array(
‘labels’ => $label,
‘description’ => ‘Post type add product’,
‘supports’ => array(
‘title’,
‘editor’,
‘excerpt’,
‘author’,
‘thumbnail’,
‘comments’,
‘trackbacks’,
‘revisions’,
‘custom-fields’
),
‘taxonomies’ => array( ‘category’, ‘post_tag’ ),
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘show_in_nav_menus’ => true,
‘show_in_admin_bar’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ”,
‘can_export’ => true,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘post’
);
register_post_type(‘product’, $args);
}
add_action(‘init’, ‘creat_custom_post_type’);
-
This topic was modified 11 years by
quangninhvn.
Hello Emil G, CPTs are very necessary for running a multi topics blog. Why not publish a guide on it?
Many users like to know how to use CPTs in theme and it’s a core wordpress functionality too.
Thanks
Hi,
Unfortunately The theme was not designed to work with custom post types so you need make custom modifications to it so you can use custom post types.
You can find info about this here: http://codex.wordpress.org/Post_Types
Thanks
Thanks Lucian. Can we give a little overview of using CPTs in this theme. How to make custom Post Template specifically to this theme. May be a short overview in this thread. Useful for many of us and upcoming customers too.
Thanks
Hi,
If you have any useful information about this and you want to share it with other who might want to use CPT you can post them here or you can open a new topic about this as well.
Note though that we do not “encourage” any user of our product to use CPT as this theme wasn’t build to work using CPT so customizing it to work using a CPT would need custom work and we cannot offer neither custom work nor support regarding the issue you might have using CPT.
Thank for the message and for understanding!
Thanks Lucian. I do understand it. Just curious about it. If i have some useful information i would love to share it.
One Last Question. How can i copy a template and rename it for Custom Post Type. Like if i made a CPT Phones and assigned no template to it. It’s fetching the single.php builtin themes template. How can i copy single.php or loop-single.php….So that we can place that exact template in the child theme and made little modifications. and rename that to single-phones.php
Is it possible? And further, i know its out of topic. Just a general question.
Thanks a lot for your wonderful and timely support.
Regards
-
This reply was modified 11 years by
tenocation.
Hi,
Please follow this steps:
1. First you have to add it in the td_global.php like this: http://screencast.com/t/Oe4zmTKSBB9P
2. Then you have to add the template in the root of the theme like the others post templates: http://screencast.com/t/1FuBB1dOf
3. After this you will have to add the template in the post settings panel, like this: http://screencast.com/t/fo8cx2DcANA1
4. You have to edit the new single template custom file and set it to call the loo-single-custom template file like this: http://screencast.com/t/xElICZBXnJ or you can simply add the single custom file and build the template as you like, in this case you wont need to call the new loop-single-custom file.
After this steps you should find the new custom template in the post editing panel: http://screencast.com/t/rmqgnJpBSOWb
Thanks
Thanks a lot Lucian. It’s really helpful for me but i was looking for a way to add Custom Post type Template only.
A Template that is called by a custom post type only not inside posts. I just need to copy single-loop-1.php for my Custom Post type “phones”. I will then add little shortcodes to that template.
Now if i copy the contents of single-loop-1.php to single-phone.php it’s not working. May be i can add in some different way so that it start working.
Thanks a lot.
Hi,
You can try to search online for a way to implement CPT. You can read here a bout this: http://getflywheel.com/wordpress-custom-post-types-and-custom-fields/
Hope this helps!
Thanks
Hi,
Sorry for the inconvenience! Please send an e-mail at contact@tagdiv.com specify the issue (or paste a link to this conversation) and we will try to find a solution.
Thanks for the message!
Hi,
Unfortunately not all the files can be modified via child theme, you will need to make this changes to the main theme, you can check which files can be modified via child theme here: https://forum.tagdiv.com/child-theme-documentation/
Thanks
Thanks a lot Lucian. @Carel tagDiv team is really very supportive and i think they will help you to fix any problems. And For tagDiv Team, please please guide us all how to implement a specific Template of Newspaper theme like single_template_1.php to a newly created Post Type Like “Books”.
So that we can make amendments to that template as our wish in the future. Thanks
In Short We want to Copy a template “Single_template_1” for our custom post type “Books”. So, that we can amend that template later and this doesn’t affect the original single_template_1. Because we will rename this template to single_template_books.php
I think you better understand what we want to achieve.
Thanks a lot.
Hi Lucian!
How to choose a fixed-post interface. For example, I would like Custom Post Type display template post is style 2 ?
http://screencast.com/t/rmqgnJpBSOWb
yeah Exactly the same question. Thanks @quangninhvn for screenshot. Thanks
Hi,
If you already created a custom post type you just need to change the name of an post template as single-bk.php (in this case the the “bk” is the slug of a new custom post type) and add inside that file the code for the template you want the new CPT to use, so if you want your CPT to use the post template 2 style you will have to add that code.
I have tested this using the latest theme version and works.
I have used the free Types – Custom Fields and Custom Post Types Management plugin which includes lots on info to help you build and customize your CPT.
If you want to add multiple layouts and styles to your CPT then you will need custom work for that and you will have to get someone to help you with that if you don’t know hoe to do it.
Thanks
Thanks Lucian. But whenever, I add the code of single-template-2.php to single-products.php it gives me a blank page. How are you adding the code. Can you paste the whole code of single-template-6 that you added to single-bk.php.
Thanks
Hi,
My single-bk.php file contains the code for single.php file, the default post template.
First make sure you copy and replace your custom post type template with the single.php file code. After you did this set the loop-single template which you want to use like this: http://screencast.com/t/nlj95x5jktk3
If this dose not work please go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure.
Thanks
