[Resolved] Create custom template for pages which includes sections options / using templat

Home Forums Support [Resolved] Create custom template for pages which includes sections options / using templat

Home Forums Support Create custom template for pages which includes sections options / using templat

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #985057
    Brad

    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 page

    Pages Baseball Teams
    Add new Baseball Team Page

    In 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://wordpress.stackexchange.com/questions/23674/can-i-assign-a-template-to-a-custom-post-type/264573#264573

    https://generatepress.com/forums/topic/create-a-new-page-template/

    #985238
    Brad

    I’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.

    #985282
    Tom
    Lead Developer
    Lead Developer

    Hi 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 🙂

    #985309
    Brad

    Yes 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 ambassador

    I 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.php

    Get 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,
    Brad

    #985608
    Brad

    I just found this post type switcher plugin.
    Possibly if I first create my CPT.

    MyCPT
    Add new myCPT

    Next 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?

    https://wordpress.org/plugins/post-type-switcher/

    https://wpshout.com/quick-guides/change-post-type/

    #985620
    David
    Staff
    Customer Support

    Hi 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/

    #985627
    Brad

    Yes. Very cool! Sincere thanks. Will try it out when on desktop.

    #985630
    David
    Staff
    Customer Support

    You’re welcome

    #985652
    Brad

    It worked! Thank you! You saved me A Lot of trial and error dev time

    #985654
    David
    Staff
    Customer Support

    Glad to be of help.

    #985669
    Klaus

    Hello, does this filter give me the possibility to use “sections” with woocommerce products? (Where using sections is not enabled). Regards Klaus

    #985673
    David
    Staff
    Customer Support

    Hi there,

    unfortunately no – Woo is a particular post type made up of several fields for their content.

    #985677
    Klaus

    Thanks.

    #985683
    David
    Staff
    Customer Support

    You’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.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.