Support » Fixing WordPress » Need Help : Thumb image css not recognized

  • 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 class="random-content">
    <a href="<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <p><?php echo dp_clean($post->post_content, 80); ?></p>
    <?php endwhile; ?>
    <!--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

  • The topic ‘Need Help : Thumb image css not recognized’ is closed to new replies.