Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Premade layouts for cpt with patterns or elements or?

  • Hi Team GP, I’m trying to achieve this – My API creates new sites as custom post types. Now I want, when a new site is made, that it takes the pattern I made, like a template. I tried elements with layout, but there is no way to add the pattern. Should I try a hook (inside content), but what to insert? Something like <!– wp:block {“ref”:3430} /–> which is a reusable block?
    Any ideas, on how to setup a page before the API creates this site?
    Thanks in advance.

  • Hi there,

    I’m not sure I understand your question, can you explain some more or with some examples?

  • Hi Ying,
    I have CPT – Custom Post Types – for a hotel. 1 for rooms, 1 for offers.
    Workflow now: The API creates a page inside the CPT from a json-file and fills the content into customfields.
    Than I have to go to this page, insert a pattern/template which corresponds with the customfields and makes so a perfect page.
    What I want. When the API creates a page, the template/pattern should instantly be in this page, so the page looks nice, without touching it.
    So, I’m trying to achieve – When a page is created in the CPT ‘offers’, the pattern/template should be in this page. The pattern/template is always the same.
    What I tried: Elements with hook, generate before main content – does nothing.
    Elements Layout – no fields for prefill.
    So, what should I do, that when a page is created, the pattern/template is there – kind of prefilled?

  • I got it, what you need is a block element – content template.
    https://docs.generatepress.com/article/block-element-content-template/

    You can pre-build the layout, and dynamically pull the content/title/custom fields via GB’s headline/button/container.

    However, the content template won’t show in the post editor, it only shows the result when the page is previewed or published.

  • content-template is for posts only – no function for sites or custom post types.
    Anyway, I made it with elements – block – generate_before_footer and this works.
    As you mentioned you cant see it in the backend, but in the frontend it shows up.
    Thank you.

  • content-template is for posts only – no function for sites or custom post types.

    No, you can assign it to CPTs as well.

    The content template can be used on single posts, single pages, single cpt, all archives and blog 🙂

  • How?
    Elements > Block
    Content Template = ok
    And them? Tag name > div
    Apply to > Posts with term (All posts, first post, post with custom field – don’t work)
    Taxonomy > ?
    Term Name > ?
    Parent Element > ?
    Do you know which config is needed to create a content template before the API brings data to the CPT?
    Thank you.

  • Apply to > Posts with term (All posts, first post, post with custom field – don’t work)

    CPT > All CPTS should work.

  • Should work, but is not there.
    So i added an additional category to the cpt, so at least the category is visible, but has no effect on the template.
    Because i can not add the category before the API makes the cpt.
    As i already mentioned, there is a workaround, but still curious – keeps me awake;)
    details template

  • Hi there,

    You should add it through the Location settings. If your custom post type is named “Hotel,” then select “Hotel > All Hotels” in the Location dropdown.

  • ” alt=”detail” />
    No CPT available

  • looks like imgur and imgbb not working

  • Hi there,

    that is not the correct place.
    You need to set the Display Rules Location. See here:

    https://app.screencast.com/d8nrrJ3Jpz3yn

  • Settings for this topic:
    Elements > Block > Content Layout – Dont touch any settings (if you want to apply it to a CPT)
    and choose the Localization where it should appear.

  • Did you see the screenshot o provided?
    You need to set the Display rules Location to match your post type.

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