The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

get_category_ID (or something like it?) (2 posts)

  1. thornomad
    Posted 10 years ago #


    I have created some "includes" -- files that I want included on a couple of my various template files. I am trying to accomplish the following:

    I want my posts (not the whole look, just the post portion) to be formatted differently depending on their category. Different font, paragraph style, etc.

    I have diifernt CSS for each of my three categories.

    I am looking for something like:

    <?php include(TEMPLATEPATH . '/post-style-1.php'); ?>

    I suppose I could create a bunch of if/else statements, but what I wanted (since my files are numbered by category) was some sort of function from wordpress that will automatically determine the category of the post ... so I can have it be just:

    'post-style-'$cat'.php' or 'post-style-'wp_get_category_ID()'.php'

    I know it can be done, I just can't figure out how to write it.



  2. niziol
    Posted 10 years ago #

    I've done this yet myself, but I think the Category Templates article might be able to help you out.

    Good luck,

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.