Forums

Background color on text in Twenty Ten (17 posts)

  1. JKorgaard
    Member
    Posted 6 months ago #

    Hey

    I can't find where to change the background color for text in a single post in Twenty Ten theme.

    Here is a link

    I can't where to change it in style.css. I think I might need to change something in single.php?

    Any ideas?

    Jan

  2. peredur
    Member
    Posted 6 months ago #

    First of all, if you're going to modify a default theme like twentyten, you must do it in a Child Theme. If you don't, an upgrade to WP could overwrite your customisations.

    As to your question, I'm not entirely sure where exactly you want to change the background colour: whether it's just for the text or for the element in which the text is located. The latter would be more usual.

    If you look at the structure of the HTML in Firebug or equivalent, you will see that the text is within a div element with the class of 'entry-content'. So you may want to style that. Something like:

    div.entry-content {
      background-color: #xyz; /* i.e. whatever colour you want */
    }

    You put the new style rule at the end of your child theme's style sheet.

    If it's not that div you want to style, you'll have to let us know.

    Cheers

    PAE

  3. JKorgaard
    Member
    Posted 6 months ago #

    If you see "posted on" in the theme it's with a transparent background. That I would like to change to the color white :-)

    I've made a child theme :-)

    And thank you for taking time to help :-)

    Jan

  4. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

    Try using Firefox with the Firebug add-on for this kind of work.
    http://getfirebug.com/

  5. peredur
    Member
    Posted 6 months ago #

    As ever, esmi is spot on.

    Have you tried the rule I gave you? If so, does it do what you want? If not, what's wrong with it?

    Well done for sorting out a child theme.

    No problem about the help. It's what we're here for. And we've had plenty of help ourselves along the way.

    Cheers

    PAE

  6. JKorgaard
    Member
    Posted 6 months ago #

    @esmi: I've got Firefox and firebug but doesn't really got into yet (got it today)

    @peredur: Yes I've tried the piece of code you gave me but didn't work.

  7. JKorgaard
    Member
    Posted 6 months ago #

    I've found it to be in the loop.php that somehow it's not referring to something in style.css.

    First piece of code:

    <div class="entry-utility">
    				<?php if ( count( get_the_category() ) ) : ?>
    					<span class="cat-links">
    						<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    					</span>
    					<span class="meta-sep">|</span>
    				<?php endif; ?>
    				<?php
    					$tags_list = get_the_tag_list( '', ', ' );
    					if ( $tags_list ):
    				?>

    If you look thru it you can see the span is but it I don't think refers to the stylesheet.

    Am I on the right track?

  8. peredur
    Member
    Posted 6 months ago #

    In what way doesn't it work? It's very hard to help unless you say exactly what you're after.

    But here's another attempt. There's a rule like this:

    #content p, #content ul, #content ol, #content dd, #content pre, #content hr {
      background: none repeat scroll 0 0 #FFFFFF;
      margin-bottom: 24px;
    }

    It's a bit of a strange one, TBH, because it means that anything farther up the food chain is going to be overwritten by it. You could try adding a rule:

    #content p, #content ul, #content ol, #content dd, #content pre, #content hr {
      background: /* your choice of colour */;
    }

    ... but I think I'd be more tempted to do something like:

    div#content div.entry-content {
      background-color: /* your choice of colour */;
    }

    By doing that I'm trying to set the background colour of the divs, including all their contents like p, ul, ol, dd, pre and so on. Whether it's specific enough to take precedence over the ones in the current rule, I don't know (and I find it easier to just try it, rather than trying to do the arithmetic). You'd need to try it.

    If you make a change, and it, "Doesn't work", it helps if you leave it in your style sheet so that we can look at it and see what's going on.

    Cheers

    PAE

  9. peredur
    Member
    Posted 6 months ago #

    I don't know what you mean with the piece of code you posted.

    Things like background colours are always determined by what's in the style sheet.

    There are several <span> elements in the code you quote. Which one do you want to style. They also look as though they're referring to category and tag lists. I thought you were referring to a single post page.

    Cheers

    PAE

  10. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

    Things like background colours are always determined by what's in the style sheet.

    Which is where Firebug comes into play. Use it to inspect any element on a page and see what CSS (if any) is being applied.

  11. JKorgaard
    Member
    Posted 6 months ago #

    What I'm after!

    I would like to have theme where the first page is a picture (home). Check

    Then I would like to have all the texts widgets etc. In a black box with white background. Not check.

    The background changes from white to transparent. I want it white.

    The code I posted was to show that some text are written in the loop.php like

    <span class="cat-links">
    						<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    					</span>

    "Posted on" as I see it, doesn't refer to the stylesheet?

  12. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

    With all due respect, do you understand how stylesheets work? They are applied to the whole page via the <link href="stylesheet_url" type="text/css" rel="stylesheet" /> in the <head></head> section of each generated page. There should never by anything in the PHP code or the markup that references the stylesheet outside of that section - only class and ids.

  13. JKorgaard
    Member
    Posted 6 months ago #

    No, I don't now how a stylesheet functions :-)

    Still I wouldn't write here if I knew everything.

    What I do know is that the *.php have to refer to the stylesheet. And I don't think it does. I've found the text in loop.php and I can change that but I can't change the background color.

    @peredur: The code didn't work but I think I have to refer to the stylesheet in the line with the text in loop.php. Thank you for effort to help and sorry for being bad of explaining my problem...

  14. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

    What I do know is that the *.php have to refer to the stylesheet.

    And that's what your header.php template file does (in conjunction with the theme's functions.php file). Otherwise you would not have any colours, formatting, or styling on your pages. You will never find a reference to a stylesheet in any other template file.

  15. peredur
    Member
    Posted 6 months ago #

    No. The template files don't have to refer to a style sheet. That's done in header.php for most themes, using a <link> element. It's done in header.php because <link> elements must appear inside the HTML <head> element.

    If you don't understand how these things work, I think you need to do a bit of learning before you start trying to mess with themes. To customise a theme you should at least know the basics of HTML/CSS and a smattering of PHP

    I'd suggest you just create a site using a theme of your choice without customisations as a starter. When you're happy you can do that, you might start to learn the basics of HTML/CSS. And then when you've got that under your belt you'll be in a better position to start customising your theme.

    Theme customisation assumes at least a basic knowledge of how these things work.

    Cheers

    PAE

  16. JKorgaard
    Member
    Posted 6 months ago #

    You're both so really right.

    I'm not a web developer at all. I'm something different.

    The thing is I just wanted to change this little thing and then I'll do the rest of the fittings. The thing is I will archive this customization.

    Thank you for your help and useful information about my way of doing things :-)

  17. peredur
    Member
    Posted 6 months ago #

    Good for you!

    If you just work with the default setup for a while, you'll come to understand how it all fits together. When you feel that's happened, that will be the time to start looking at making customisations.

    I look forward to hearing from you when you think the time is right, and we'll give you all the help we can.

    Cheers

    PAE

Reply

You must log in to post.

About this Topic