• Resolved jonniboo

    (@jonniboo)


    Hi,
    I am trying to use the ‘monochrome’ theme for a certain category with ID=3.
    Not sure how to create category-3.php and where to place it.

    Am new to WP so please be clear ??

    Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • A “theme” is not assigned to just one page. It’s a directory with a style sheet and accompanying files that are used to display the database content USING either index.php, page.php, category.php or single.php based on the type of content (Page Post vs. Category Post(s)).

    If you mean creating that custom category.php file, you simply name the file after the category ID of the category you want to have use it. So, if your category is 9, then the file name would be category-9.php and would be uploaded right in with the other files in the theme you are using. All other categories will use either category.php (if there IS one) or index.php (which HAS to be there).

    Does that make more sense to you? Let me know if you need more help!

    BTW, if you need to get the ID of a category, you can get into your admin and go to Posts>Categories and hover over the desired category in the list. You should see the ID# in the status bar at the bottom of the browser window…. something like edit&cat_ID=#

    Thread Starter jonniboo

    (@jonniboo)

    Hi,

    I’m not sure which file to use in order to create category-3.php (for ID=3). Have tried it by copying and renaming both the archive and the index php files but hasn’t worked.

    If you don’t have a pre-existing category.php file in your theme, use a copy of archive.php, rename it to category-3.php and then start customising it.

    Remember to press CTRL and F5 simultaneously when viewing an updated page/site. Or try emptying your browser cache. This should ensure that your web browser fetches a fresh copy of the page rather than serving up an out-dated copy from your own cache.

    Thread Starter jonniboo

    (@jonniboo)

    Hi,

    Have both copying and renaming archive.php to category-3.php in the ‘monochrome’ theme folder, but it hasn’t worked.

    Any ideas why?

    Works fine for me…so once you copy archive.php to category-3.php are you making changes to category-3.php so you can distinguish that display from other categories that are displayed with archive.php?

    Related:
    Template Hierarchy
    Stepping Into Templates

    Thread Starter jonniboo

    (@jonniboo)

    Its a different theme from the rest of the site, I’m using the default theme at the moment for the site, and the monochrome theme just for category-3, so I’m expecting to see changes applied to just this category.
    Or is there another step I need to do?

    You would need to create the category-3.php in the wp-content/themes/default folder then.

    Also remember, when a WordPress core update happens, changes to the files in the wp-content/themes/default folder will be overwritten with a new set of files.

    Related:
    https://www.google.com/search?q=wordpress+different+themes+for+different+categories

    Thread Starter jonniboo

    (@jonniboo)

    Hve just renamed the archive in default theme to category-3 but doesn’t make any difference.

    You are using the WordPress Default theme for everything but category 3 posts. You want to display category ID 3 posts using a ‘look’ that is that of the Monochrome theme.

    You will need to customize the category-3.php to be the look you want. It will take some work to make that look like the ‘Mmonochrome’ theme.

    Please review Category_Templates and review some of the articles here:
    https://www.google.com/search?q=wordpress+different+themes+for+different+categories

    Thread Starter jonniboo

    (@jonniboo)

    Thanks for the advice Michael. I’ll check the articles.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How do I assign a specific template to just one category.’ is closed to new replies.