Support » Themes and Templates » Cannot pick up the archive-postype template

  • Resolved Christine Rondeau

    (@crondeau)


    Volunteer Forum Moderator

    I created a custom post type for my testimonials and set up a genre taxonomy for these.

    I can display the links to the various genre and when I click on the link, I do get the testimonials with the correct taxonomy, but it’s displaying them using the archive.php template.

    I want to display them differently and so set up a archive-testimonial.php template, but it’s just being ignored.

    I tried naming it category-testimonial.php, taxonomy-testimonial.php, but nothing works.

    Here is the link to the testimonials if it helps.

    http://www.leeashley.com/wp/testimonials/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Tyler Sticka

    (@tylersticka)

    Saw your plight on Twitter, thought I might come to the rescue (or at least attempt to).

    Here are my two guesses…

    Firstly, are you setting has_archive in your register_post_type arguments to true?

    Secondly, have you tried calling flush_rewrite_rules() after your register_post_type line?

    If neither of those suggestions are applicable, I think we’ll need to see what your register_post_type args look like to provide more assistance.

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    This is what I have in my function file right now.

    http://pastebin.com/t1bf94ZA

    I’ll look and see if I can figure out this flush_rewrite_rule()

    Tyler Sticka

    (@tylersticka)

    Yeah, your arguments look fine. I would just insert:

    flush_rewrite_rules();

    After line 62, right after you register your taxonomy. Then, reload your page (so functions.php executes) and see if it works.

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    There must be something else going on somewhere cause it’s still not working…

    Arrrgggg…..

    I’ve got someone else looking into it though.

    Tyler Sticka

    (@tylersticka)

    Sorry to hear that! Maybe one little argument is off.

    One other thing to keep in mind. It’s generally considered poor practice to name custom post types without a theme- or plugin-specific prefix. For example, instead of testimonial you’d use bluelime_testimonial and then use the rewrite argument to specify a slug of testimonial.

    If you happened to try any plugins or something else that may have used a similar post type, you can run into some nasty conflicts.

    Now, I doubt that’s what’s happening here, but it’s worth mentioning.

    Best of luck!

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    I hear you Tyler, I usually have my prefix, but the code that you are seeing now has been changed about 5 times since we’ve started this thread. I’m trying some code that a twitter follower provided. I’ll go and fix it once I have this going.

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    With the help from Tyler and other twitter friends. I managed to get this working. The Custom Post Type code was updated in the functions.php and I create a taxonomy-genre.php template.

    Here is the code if anyone wants it.

    Code for the CPT – http://pastebin.com/GrcRpCTR

    Code used in my taxonmy-genre.php http://pastebin.com/tW7KZUiN

    Yes, I hardcoded the h1, tsk, tsk…
    Whatever…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cannot pick up the archive-postype template’ is closed to new replies.