• Hi everyone

    New to WordPress. I’m exploring the possibility of moving to WordPress because I’d like to layout posts differently based on their category.

    I found this help page: https://www.ads-software.com/extend/ideas/topic.php?id=227

    Created a new category file, uploaded it to the theme folder in the correct directory, and see it located in the file list of the themes design form in my admin. I called it two things. “category-blockquotes.php” and after the category I created called “blockquotes” came out without the layout I created in category-blockquotes.php, I renamed the file, “category-6.php” like the file used in the help page. Again had the same result.

    How do I go about getting the category to use the category design I create?

    Again, the goal is to use different layouts for posts depending on their category.

    Thanks for any help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • This is probably what you’re looking for:
    https://codex.www.ads-software.com/Category_Templates

    Scroll down to the section titled “What Template File is Used?”

    Thread Starter james-orr

    (@james-orr)

    Hey there

    That’s the process I followed in what I described above. Did I miss any steps? I did exactly as I described above, so if you see anything I might’ve missed, that would be great.

    that method would only work on the category pages, not the actual post’s page though, right?
    i think you want something more like this:

    Styling Different Categories
    This snippet assigns a specific stylesheet (category-15.css) to category 15 and will assign the rest of the
    site the default stylesheet (style.css). Place this code in the <head> area.

    <?php if ( is_category('15') ) {
      <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/cat-15.css"
    type="text/css" media="screen" />;
    <?php } else { ?>
       <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
    type="text/css" media="screen" />
    <?php } ?>
    Thread Starter james-orr

    (@james-orr)

    Thank you. One of the things I’d really like to do is change the actual layout of different types of posts. For example, I’d like the blockquote to span the width of the page. Typically I have the blog post to the left with comments in a div thats floated right. When I have blockquotes, I’d just like to have one div that spans the width. Will this help me achieve that?

    yes. all that float behavior should be controlled through the style sheet. so in the style sheet for that category, you can just change the float behavior to get the results you want. thats whats so nice about using css.

    Thread Starter james-orr

    (@james-orr)

    Awesome. Thanks so much.

    How do I know what category number my categories coincide with?

    When you’re in the Manage Categories window you’ll see a URL containing the category ID in your browser’s status bar when you hover over the various category names.

    Thread Starter james-orr

    (@james-orr)

    Sweet. Thanks, guys.

    if you get it working, I’d love to see it in action!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Changing look of post based on category’ is closed to new replies.