- This topic has 5 replies, 2 voices, and was last updated 4 months ago by David.
May 17, 2019 at 6:35 am #902553Dominik 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.
DominikMay 17, 2019 at 3:49 pm #903150TomLead DeveloperLead Developer
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.
1. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook to
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' ) ); ?> </span>
Then set the Display Rules to your CPT archive/posts.May 17, 2019 at 4:32 pm #903170Dominik 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.
DominicMay 17, 2019 at 5:12 pm #903183TomLead DeveloperLead DeveloperSeptember 19, 2020 at 2:48 am #1449652Igor
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?
IgorSeptember 19, 2020 at 4:50 am #1449734DavidStaffCustomer Support
- You must be logged in to reply to this topic.