WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Template for child archive of custom post type

[Resolved] Template for child archive of custom post type

  • Hello all 🙂

    So I have a custom post type used by a plugin – lets call it CAKE.
    In the archives, there are several sub sections of CAKE – lets call them CUSTARD, CREAM and SAUCE.
    And CUSTARD has 2 sub categorys – lets call them HOT and COLD

    Now when viewing CAKE archive at http://www.mywebsite.co.uk/cake it uses my custom template file archive-cake.php but when you view any of the sub sections of it, for example CUSTARD at http://www.mywebsite.co.uk/cake/custard it just uses the standard archive template (archive.php) – how can I get them to use my custom template?

    ADDITIONALLY – in my header.php I’m using if ( is_post_type_archive('cake') ):
    to add a something to the header for cake archive pages, but again the sub-pages of cake such as custard aren’t responding to this.

    I’m working local so can’t provide real links – sorry.

    In summary:
    http://www.mywebsite.co.uk/cake uses archive-cake.php but http://www.mywebsite.co.uk/cake/custard uses archive.php, so how do i get http://www.mywebsite.co.uk/cake/custard to use archive-cake.php

    And how do I get http://www.mywebsite.co.uk/cake/custard to respond to is_post_type_archive('cake')

    Thanks,
    Josh.

Viewing 2 replies - 1 through 2 (of 2 total)
  • HOOOLD it right there — think I’ve worked it out – I think CUSTARD and all the others are taxonomies – so I need to use is_tax().

    Seems to be working… will mark as resolved when fully tested.

    Josh.

    Yup – that’s all working 🙂 is_tax()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Template for child archive of custom post type’ is closed to new replies.