WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Background Image for posts (7 posts)

  1. Keller Bear
    Member
    Posted 1 year ago #

    Hi. I'm using the very good Two post columns Twenty Eleven child theme by Digital Raindrops and wanted to add a background image to each post excerpt on the blog page.

    Very easily I added some css:

    article {
    	background-image: url(Images/black_board.jpg);
    	background-repeat: no-repeat;
    }

    But this creates a number of problems.

    1. - This image is also added to the pages with single post.
    2. - This image was added to the comments (RESOLVED)
    3. - I want to direct some css to the h1.entry-title on the page with the grid of posts (namely add a bit of margin to push it away from the edge of the image) but know if I do that then the single post pages will be pushed accordingly.

    How do I get rid of the images on the single post and also target the h1.entry-title on the two column page only?

  2. Keller Bear
    Member
    Posted 1 year ago #

    Just to add, I realise I could target the next outer div e.g. article#post-9 but this would be useless as I would have to have separate css for each and every post number in the future.

    Help greatly appreciated!!

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    it might help if you can post a link to your site to illustrate the problem.

    generally, look into the existing page specific body_class output;

    http://codex.wordpress.org/Function_Reference/body_class

    for instance .blog for the posts page;
    or .single for single posts.

  4. Keller Bear
    Member
    Posted 1 year ago #

    Hi alchymyth

    I am still working on the site locally and really haven't changed anything of great significance.

    I did manage to write in some css that solved half my problem

    .page article {
    background-image: none;
    }

    .single article {
    background-image: none;
    }

    So really my third problem just remains. Do I need to go into single.php and add a style directly in there or is this a complete no-no and styling should be kept in the css file?

    Also, I'm having another problem (and your name keeps popping up so I was hoping I would get your attention!!) that you might have a look at if you have time? it can be found at:

    link

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    direct some css to the h1.entry-title on the page with the grid of posts

    check the css class in the body tag of that (web) page; possibly use a tool such as Firebug http://getfirebug.com/

    if that is the posts page (blog page), the css class might be .blog

    i.e. to format the h1 on the grid posts page only, possibly use:

    .blog h1.entry-title { ... }

  6. Keller Bear
    Member
    Posted 1 year ago #

    ok I will try that out, thanks. Will let you know if it works!

  7. Keller Bear
    Member
    Posted 1 year ago #

    Thanks alchymyth, this worked a treat!

Topic Closed

This topic has been closed to new replies.

About this Topic