• I have Postie installed so that I can send photos from my cellphone directly to my site and it works great. Any entries submitted this way are in their own category.

    What i’m trying to do is have WP automagically center the image on the page. Is there a way to have a certain CSS attribute apply to a particular category all the time?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • In your <head>:

    <?php if(is_category('Category Name') : ?>
    <style type="text/css">
    <!--
    this { }
    .that { }
    #the-other { }
    //-->
    </style>
    <?php endif; ?>

    More on ‘conditional’ tags:
    https://codex.www.ads-software.com/Conditional_Tags

    Thread Starter pyrofenix

    (@pyrofenix)

    THANK YOU!

    Thread Starter pyrofenix

    (@pyrofenix)

    Doh. Spoke too soon. I get the following error when I input the code

    “Parse error: syntax error, unexpected ‘:’ in /home/pyrofen/public_html/words/wp-content/themes/new theme/header.php on line 46”

    I put the code just before the closing head tag in my header.php file.

    Grr. I slipped up on the coding, sorry. First line should be:

    <?php if(is_category('Category Name')) : ?>

    A fricken newbie mistake…

    Thread Starter pyrofenix

    (@pyrofenix)

    Thanks, that fixed the error.

    I’m still having a problem though – i’m an idiot sometimes, sorry.

    https://www.pyrofenix.com/words/

    This is the blog in question, the top entry was posted directly from my cell phone (most entries from my phone will be just like this), no text. just the image. I’m trying to have the linked image behave differently from normal links. I want it centered with the gray box around it similar to the images on the sidebar.

    I can’t seem to get it to work though. Any ideas?

    Thanks again!

    This seems like it will work for that:

    .entry div {
    text-align: center;
    }

    .entry div img {
    padding: 8px;
    border: 1px solid #d0d2d2;
    background-color: #e6e6e6;
    }

    But note you want this in your stylesheet at all times (assuming this request is directly related to the original post) as you need to affect your home, category, and single post pages.

    Thread Starter pyrofenix

    (@pyrofenix)

    Thank you! I owe you big time!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Specific CSS attributes for a category?’ is closed to new replies.