- This topic has 1 reply, 2 voices, and was last updated 4 years, 3 months ago by
Elvin.
-
AuthorPosts
-
December 14, 2021 at 7:18 pm #2049371
Josh
I have a custom taxonomy (brand) for my CPT (hotel). I’m trying to have a page that is my “portfolio of brands” page. I believe the best way to do that is to have a normal page either create a shortcode with “get_terms()” or use a page template. Is there a better way to do this though? Is there a wordpress page template built in automatically?
The problem I am having is on that page when I have a user click through to an actual taxonomy term archive (I am not sure about the nomenclature for this page ) It loads the archive.php template. This means I should copy that page for my term template and name it “taxonomy-brand.php”. Is that correct?
Assuming it is, what other file to do I need to pull into my child theme? there is a line that says “generate_do_template_part( ‘archive’ );” what is this pulling? Whichever file this is is that the only one i need to move to my child theme, or do I actually need to pull more than 1 file?
P.S. when I search this forum for “taxonomy.php” The site returns an error page…
December 14, 2021 at 10:04 pm #2049442Elvin
StaffCustomer SupportHi Josh,
By default, the theme pulls in this file:
https://github.com/tomusborne/generatepress/blob/master/archive.phpand this one: (For archive.php’s content structure which is basically hooked in html elements)
https://github.com/tomusborne/generatepress/blob/master/inc/structure/archives.phpAs for what template is loading:
By default, WordPress tries to look for the template appropriate to the queried page.
The hierarchy of what it looks for it this list –
https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/#:~:text=The%20category%20hierarchy,index.phpIt checks for #1 first, if #1 doesn’t exist, it goes further down the line ’til it finds what it can use.
(if you scroll down the article I’ve linked, you’ll see a similar hierarchy for custom taxonomies)As for what you copy, you can try copying the contents of https://github.com/tomusborne/generatepress/blob/master/archive.php as a baseline and modify it to your preference.
-
AuthorPosts
- You must be logged in to reply to this topic.