WordPress.org

Forums

Need Help : Thumb image css not recognized (1 post)

  1. xinfo
    Member
    Posted 6 years ago #

    Hi Guys

    i am trying to pull thumb image from my own function

    # Displays post image attachment (sizes: thumbnail, medium, full)
    function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
    if ($postid<1) $postid = get_the_ID();
    if ($images = get_children(array(
    'post_parent' => $postid,
    'post_type' => 'attachment',
    'numberposts' => 1,
    'post_mime_type' => 'image',)))
    foreach($images as $image) {
    $attachment=wp_get_attachment_image_src($image->ID, $size);
    ?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
    }
    }

    well i am able to pull the thumb image but it don't recognized img css

    here is my code syntax

    <div class="home-squares">
    <div class="home-headings">Random Articles</div>
    <?php $my_query = new WP_Query('orderby=rand&showposts=2');
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <div class="random">
    <div class="random-image">
    <a href="<?php the_permalink() ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
    
    </div>
    <div class="random-content">
    <a href="<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <p><?php echo dp_clean($post->post_content, 80); ?></p>
    </div>
    </div>
    <?php endwhile; ?>
    </div>
    <!--End Random Articles-->

    My css

    /**** Begain Random box **/
    
    .home-squares {
    background-color: #FFFFFF;
    width: 280px;
    display: block;
    padding: 10px;
    border: 1px solid #EBEBEB;
    float: left;
    margin-right: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
    }
    
    .random-image {
    width: 70px;
    height: 80px;
    border: 5px solid #F8F4E0;
    float: left;
    }
    
    .random-image .img {width: 70px;
    height: 80px;
    	;
    }
    .random-content {
    float: right;
    width: 190px;
    
    }
    .random {
    width: 280px;
    float: left;
    margin-top: 10px;
    }
    .home-headings {
    height: 27px;
    border: 1px solid #DDD7B3;
    background-color: #F4EFD2;
    background-image: url(images/heading-bg.gif);
    width: 268px;
    color: #575447;
    font-size: 13px;
    font-weight: bold;
    padding-left: 10px;
    padding-top: 8px;
    }

    well i don't want to pull via custom field

    Looking forward for your help

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags