WordPress.org

Ready to get started?Download WordPress

Forums

Category templates not loading (6 posts)

  1. TheBryanWhite
    Member
    Posted 1 year ago #

    Greetings, programs!

    I recently migrated a single WordPress install into multisite and for the most part, the transition was smooth. However, I have two sets of pages, listings posts in categories that are no longer working like they did before the migration.

    I have 3 category templates set up.

    category.php
    category-blog.php
    category-research-center.php

    This page should load category-blog.php : http://stoppredatorygambling.org/blog/category/blog/business-model/

    This page should load category-research-center.php: http://stoppredatorygambling.org/blog/category/research-center/addiction/

    But neither do as they're supposed to. They're both loading category.php

    Now, the weird thing is that http://stoppredatorygambling.org/blog/category/blog/ lists all pages in the "blog" category and should load category-blog.php and it does. On each of the pages I have listed above, the category list in the sidebar lists child categories of the top-level categories "research-center" and "blog" so it would appear that when you click on a child category of either page, the category template defaults to category.php instead of the template for its parent category.

    I've been struggling with this for a couple of days. I really need to get out from under this problem before I lost my mind.

  2. What happens if you use category-ID.php instead of the slug?

  3. TheBryanWhite
    Member
    Posted 1 year ago #

    Templates still don't load.

    BUT!

    If I set the filename as something like category-75.php (the Addiction category - this also works if I change it to category-addiction.php) and then I click on Addiction, the proper template loads. So I have to be specific about the child category in order for the template to load. This, obviously, doesn't meet my needs but I'm getting somewhere.

  4. That kind of makes sense actually... The category-slug.php format is always meant to be the last slug in the chain.

  5. TheBryanWhite
    Member
    Posted 1 year ago #

    Interesting. Is there a way to modify this behavior so that it loads the template by the parent category instead of looking for templates with the child category slug or ID?

  6. Not that I'm aware of... But I don't claim to be a theme expert. :) You may want to post in that subforum?

Topic Closed

This topic has been closed to new replies.

About this Topic