• dougal-mcguire

    (@dougal-mcguire)


    Hi all,

    https://i44.tinypic.com/f4hf8p.jpg

    I’d like to have the background in Archive in my little Latest News widget, but no matter how much I try I can’t seem to get it to work.

    The code for the widget is:

    <li>
        <ul>
    
        <?php
            $recentPosts = new WP_Query();
            $recentPosts->query('showposts=5');
        ?>
        <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
            <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
    
     <!-- story header -->
            <div class="postheader">
                <div class="postinfo">
                <p>
                <?php printf(__('Posted by %s on %s','fusion'),'<a href="'. get_author_posts_url(get_the_author_ID()) 
    
    .'" title="'. sprintf(__("Posts by %s","fusion"), attribute_escape(get_the_author())).' ">'. get_the_author() 
    
    .'</a>', get_the_time(get_option('date_format'))); ?> <?php edit_post_link(__('Edit','fusion')); ?></p>
                </div>
            </div>
            <!-- /story header -->
    
    <?php the_excerpt(); ?></li>
        <?php endwhile; ?>
        </ul>
    </li>

    This is exactly the same CSS code (postheader,postinfo) that’s in the Archive section, but the background doesn’t seem to show in the PHP widget.

    From Stylesheet:

    .post .postinfo, .attachment .postinfo{
      background: #e2e3e3 url(images/postinfo-bg.gif) repeat-x left top;

    Any ideas why this might be? There’s 2 backgrounds, the little line in the news title, and then the shaded background in the posted by.

    wp-content/themes/fusion/images/div-h2.gif
    wp-content/themes/fusion/images/postinfo-bg.gif

    Any ideas would be very much appreciated. Thanks

    PS I’d even be happy enough to add the backgrounds manually instead of through CSS if anyone would know how to do that.

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Michael

    (@alchymyth)

    a link would help;
    css issues are difficult to discuss with an image and some code, as there could be some more specific styles which are ‘blocking’ what you would like to achieve.

    Thread Starter dougal-mcguire

    (@dougal-mcguire)

    Appreciate you taking the time to have a look.

    https://easilydone.co.uk/TPA2.0/WP/?m=200909

    If it’s easier, I’m fine with just some localised background code in the php script.

    Thanks again.

    Michael

    (@alchymyth)

    you could try and add this to style.css (where the styles are that you showed)

    .postheader .postinfo p {
      background: #e2e3e3 url(images/postinfo-bg.gif) repeat-x left top;padding:3px 2px;
    }

    makes sense if you look at the code from the widget:

    <!-- story header -->
            <div class="postheader">
                <div class="postinfo">
                <p>

    you can leave the padding away.
    i used the web developer add-on for firefox to check the css – imho worth downloading, installing, and playing with.

    Thread Starter dougal-mcguire

    (@dougal-mcguire)

    Nice one alchymyth, that worked great.

    Would you know how to get a horizontal line below each entry?

    Michael

    (@alchymyth)

    try to add this at the end of style.css:

    .execphpwidget ul li { padding-top:5px!important;border-bottom:1px solid #aaa;}

    Thread Starter dougal-mcguire

    (@dougal-mcguire)

    Absolutely brilliant. Thanks very much for helping me out. Looks a ton better. Cheers.

    Thread Starter dougal-mcguire

    (@dougal-mcguire)

    Just looking at the last bit, it works perfectly in Firefox, but doesn’t seem to show the line in IE.

    Michael

    (@alchymyth)

    Thread Starter dougal-mcguire

    (@dougal-mcguire)

    Genius, working perfectly now in IE and FF. Thanks again, really appreciate you taking the time to help me out. All the best.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Having trouble getting a background to show’ is closed to new replies.