Home › Forums › Support › Create custom template for pages which includes sections options / using templat
- This topic has 13 replies, 4 voices, and was last updated 4 years, 8 months ago by David.
-
AuthorPosts
-
August 15, 2019 at 10:51 am #985057Brad
Is it possible to duplicate the the template that uses sections and rename it so as to create pages similar to CPT?
Pages
Add new pagePages Baseball Teams
Add new Baseball Team PageIn wp-admin when selecting “add new Baseball Team Page” the options of a page, sections, etc would be available as if you selected “Add new page”
There’s no drop down template selection box on in the Pages Attribute meta box in wp-admin in this theme so I’m not sure how to utilize custom templates.
Thanks for your help.
Reference research link:
https://generatepress.com/forums/topic/create-a-new-page-template/
August 15, 2019 at 3:49 pm #985238BradI’m doing this course. It talks about creating custom templates for CPT and throwing them in a plugin.
https://www.lynda.com/WordPress-tutorials/WordPress-Custom-Post-Types-Taxonomies/2212269-2.html
My question goes back to can i somehow retain the look and functionality of GP (add page header, use sections) by duplicating the corresponding GP php template that pulls in the sections features for pages?
Thanks for your help in pointing me in the right GP file direction if this is possible.
August 15, 2019 at 5:38 pm #985282TomLead DeveloperLead DeveloperHi there,
Just to confirm, are you wanting to create a page in Sections, and then use that page as a template to create other pages?
If so, it’s not easily do-able with Sections itself. If you create the post in the CPT, you can then duplicate it using a plugin like this: https://en-ca.wordpress.org/plugins/duplicate-post/
It’s not ideal, but it means you don’t need to start from scratch each time.
Let me know 🙂
August 15, 2019 at 6:33 pm #985309BradYes and no. Basically I’d like to have the options available from GP premium (sections, etc) be available in a CPT template possibly by me duplicating the template file that GP pages uses? I realize it’s going to be a challenge.
CPT name = ambassadors
Add new ambassadorI copy over GP page.php from parent theme into the child theme.
I rename it single-(my custom post type name).php
Hence;
single-ambassadors.phpGet template parts:
I create a folder structure in the child theme to match the GP parent theme adding get template part php pages as needed. Add ‘ambassadors’ to correspond php pages that i want to customize (such as removing author, date below title).I realize this is a support ticket area, not a customization forum. If I’m headed in the right direction though please let me know. Possibly the way to go is via GB function hooks and use conditionals. If this totally wouldn’t work please let me know.
All that said, if this is beyond the scope of what you can offer here or too complex to explain I respectfully understand. I’m just trying to push the envelope of what I can accomplish with GP and create a product for launch for which I’ve invested two years of my life into.
Sincere thanks for the plugin link. Interesting plugin. Will download and try it out either way.
Sincerely,
BradAugust 16, 2019 at 6:02 am #985608BradI just found this post type switcher plugin.
Possibly if I first create my CPT.MyCPT
Add new myCPTNext I converting myCPT draft to a GP page via the plugin below. I continue designing the post, now a page, using sections. When saving to publish, I duplicate it (to be safe as a testing backup). I open it and convert it back to the original CPT.
Do you think this would work?
August 16, 2019 at 6:10 am #985620DavidStaffCustomer SupportHi there,
just to be clear – you’re want to be able to use Sections in a CPT?
If so this filter does the job:https://docs.generatepress.com/article/generate_sections_post_types/
August 16, 2019 at 6:17 am #985627BradYes. Very cool! Sincere thanks. Will try it out when on desktop.
August 16, 2019 at 6:19 am #985630DavidStaffCustomer SupportYou’re welcome
August 16, 2019 at 6:47 am #985652BradIt worked! Thank you! You saved me A Lot of trial and error dev time
August 16, 2019 at 6:48 am #985654DavidStaffCustomer SupportGlad to be of help.
August 16, 2019 at 7:04 am #985669KlausHello, does this filter give me the possibility to use “sections” with woocommerce products? (Where using sections is not enabled). Regards Klaus
August 16, 2019 at 7:08 am #985673DavidStaffCustomer SupportHi there,
unfortunately no – Woo is a particular post type made up of several fields for their content.
August 16, 2019 at 7:11 am #985677KlausThanks.
August 16, 2019 at 7:20 am #985683DavidStaffCustomer SupportYou’re welcome. If there’s anything particular you’re trying to achieve with Woo Single Product then raise a new topic and we can take a look.
-
AuthorPosts
- You must be logged in to reply to this topic.