[Support request] Can not find template in pages attributes

Home Forums Support [Support request] Can not find template in pages attributes

Home Forums Support Can not find template in pages attributes

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2306014
    Budi

    Hello,

    In page attributes, I can only see Parent and Order.
    Where I can find template in page attributes?

    Thanks.

    #2306263
    Fernando
    Customer Support

    Hi Budi,

    What exactly are you trying to do? There’s no template metabox in the settings of a page or post by default.

    #2306784
    Budi

    I want to create a custom page.
    In other theme, I can see Template in page attributes

    #2306945
    David
    Staff
    Customer Support

    Hi there,

    those are custom templates that theme authors can choose to add. GP does not add any.
    But you can add your own, but it requires an understanding of PHP and HTML.
    Heres a quick how to, with the aim of using copies of the GP Single Post Templates to create your own custom template.

    1. First you must add a Child Theme to your site.

    https://docs.generatepress.com/article/using-child-theme/

    It is in the child theme folder that you will save your templates.

    2. In the Parent GP Theme folder look for the following files and copy them to the root of your child theme, and rename them

    File 1: single.php –> Rename this to eg. custom-post.php
    File 2: content-single.php –> Rename this tocontent-custom-post.php

    Note whatever you rename the single.php, eg. custom-post must also be the name at the end of your second file e.g content-custom-post

    3. Edit your newly named content-custom-post.php in a text editor or IDE.
    At the top of the template you will see this:

    /**
     * The Template for displaying all single posts.
     *
     * @package GeneratePress
     */

    Replace it with:

    /**
     * Template Name: Single Post template
     * Template Post Type: post
     * @package GeneratePress
     */

    You can set the Template Name to whatever you want.
    The Template Post type sets which post type to offer the custom template eg.

    * Template Post Type: post just for posts
    * Template Post Type: page just for pages
    * Template Post Type: post, page for posts and pages.

    4. Make any changes you want to your new templates if you need to.

    Thats it

    #2307666
    Budi

    Hello,

    What is the url to show the custom page ?
    Thanks.

    #2307668
    David
    Staff
    Customer Support

    There is no URL for the Template.
    You create a post / page select your template, and you visit the URL for the post or page you created.

    #2307739
    Budi

    Hello,

    Please check the result

    #2307761
    David
    Staff
    Customer Support

    Did you make copies of both files i told you too ?

    #2307821
    Budi

    Yes, I have made changes.
    Thanks.

    #2307837
    David
    Staff
    Customer Support

    Please note: do not add code inside the Private Information field.

    And are you happy with your changes ? as i cannot advise on how you build your own custom template.

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