Archived topic
CUSTOM ARCHIVE.PHP and CONTENT.php
9 replies · Started by FunkyCss on October 17, 2021
Hello There,
I remember in older versions Generatepress had the get_template_part( content, etc.. )
Now I notice that is tottaly different and I am really confused how it actually works? ( generate_do_template_part( 'archive' ); )
What I need to do is
To create a CPT of displaying archives ( Created a custom taxonomy and copied the archives.php )
Now I need to customise the loop content of this CPT by copy the content.php and renaming products-content.php
I believe I am right till here.
The issue is that I dont understand where to hook that products-content.php as the templating is a bit different.
Hi there,
in your custom archive template you can switch this line:
to:
get_template_part( 'content', 'your-cpt-content-slug' );
Hi David,
Yes this is with the old way and it actually works.
I am curious tho how works the new one, there is any documentation for this ? Just curious
Thank you once again.
Its just a custom function.
So you can leave it as is for example:
generate_do_template_part( 'your-cpt-content-slug' );
It will return exactly this:
get_template_part( 'content', 'your-cpt-content-slug' );
OK thank you a ton !
You're welcome
Hello,
I think I'm in the same case as FunkyCss but with standard WP categories: I need to make a custom html markup for the post in archive (or category) but I don't quite understand how I have to do it.
Could you explain me wich is the .php file I must edit or create?
Thanks in advance
Hi there,
are you wanting to modify the HTML of the standard archive pages ? Or is it for a specific post type or taxonomy or... ?
Hi David
Thank you for replying.
It's for standard archive pages. In fact, for standard category.
Regards
Hi Alberto,
Take a copy of content.php file from the parent theme, paste it into your child theme folder, then you can edit the file in the child theme.