[Resolved] Applying blog archive and single post settings to custom type post

Home Forums Support Applying blog archive and single post settings to custom type post

  • This topic has 5 replies, 2 voices, and was last updated 4 months ago by David.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #902553
    Dominik Mukrecki


    I would like to ask you how can I adapt appearance of custom post archive and single custom post? Changing settings via Customizer won’t affect this. I use GP child theme.

    I prepared some files:

    single-(here goes CPT name).php
    archive-(here goes CPT name).php
    content-(here goes CPT name).php

    EDIT: by a CPT I mean “Custom Post Type”.

    First of all I put them into main directory for a GP child theme. For example I would like to add comments link for CPT archive. The same as for blog archive. Is there any solution for example using functions.php? Or should I modify files listed above? In which way?

    I achieve something using basic PHP, but if there is more sophisticated solution I will be grateful πŸ™‚

    Thanks a lot for amazing work! It seems like GP is a killer choice for all my amateur WordPress projects.


    Lead Developer
    Lead Developer

    Hi there,

    Are you only wanting to add the comments link (like regular posts) to your CPT posts? If so, that should be pretty easy to achieve without using template files.

    For example:

    1. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
    2. Set the hook to after_content
    3. Check the Execute PHP checkbox
    4. Add the comments link function to the hook content:

    <span class="comments-link">
        <?php comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); ?>

    Then set the Display Rules to your CPT archive/posts.

    Dominik Mukrecki


    It worked immediately. I found that snippet in the theme files recently, but I didn’t know how to add it. It is so simple πŸ™‚

    Thank you a lot, I’ll let you know if something new is needed to improve on my site.


    Lead Developer
    Lead Developer

    Awesome! Glad I could help πŸ™‚


    Hi, I’ve followed your instructions but I can’t get it to work. Since this is a year old post, is something changed due to newer versions of GP?


    Customer Support

    Hi there,

    nothing has changed in GP that would affect that code from working.
    Raise a new topic and explain the issue and share a link to your site and we can have a look.

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