• Hello,

    I’ve created some custom taxonomies (styles, artist, label, & more with CPTUI and I’m now trying to create an archive for them that should look just like categories and tags archives. So I’ve created a file for each of them like taxonomy-styles.php for exemple, add them to my child theme of Twenty Twenty Two and copy/paste the code of archive-product.php for each of them. But somehowe, the the archives don’t have the same header and footer than the rest of the website.

    I’ve read that the function get_header( ) doesn’t work with a block based theme so I tried to change it for block_header_area, but no success neither…

    Any idea how to solve that?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Hey there @mimiseku93002 !

    You’ve referenced archive-product.php and taxonomy-styles.php… but child themes of block themes shouldn’t have any PHP templates. Instead, they have .html templates so they are compatible with the Site Editor. Keep in mind that block themes are built differently than classic themes – so are their child themes.

    Looking at your sample CPT archive page at the link you provided, it appears to be using archive.html, which is the template that Twenty Twenty-Two comes with. This template is automatically applied to archives for which there isn’t a more specific template available.

    If you’d just like the header in your Archive template to match your others, you can try going into the Site Editor at Appearance > Editor > Browse all templates (https://haunted-dancehall.com/wp-admin/site-editor.php?postType=wp_template)

    From there, scroll down til you see the template called Archive and click to open it. Replace the Header template part in this template with the header template part you used elsewhere, and save it.

    Going this route, there’s no need to create a custom template.

    Let me know if this solves the issue!

    Thread Starter mimiseku93002

    (@mimiseku93002)

    Hello,

    Thanks for your help and really sorry for my late reply, somehow I was sure I had already replied…

    So I did what you said, but it didn’t work, don’t know why. Here’s a screenshot of my archive’s list view: https://haunted-dancehall.com/wp-content/uploads/2023/02/Capture.png

    Thanks

    Moderator Kathryn Presner

    (@zoonini)

    Hi @mimiseku93002 – you’ll need to make sure the Header template part in your Archive template is the same one used on your other pages. Could you provide a full-window screenshot of the Archive template, which includes the preview area as well? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Archive for custom taxonomy’ is closed to new replies.