WordPress.org

Ready to get started?Download WordPress

Forums

featured image on single post (3 posts)

  1. Con91
    Member
    Posted 9 months ago #

    Hi,
    I need to make the posts on my site so that the featured image of the post doesn't show up when you click the actual post if that makes sense. I know its something to do with the single.php file. Here is the code;

    <?php
    $image_id = get_post_thumbnail_id ( $post->ID );
    if($image_id <> ''){
    //$image_url = wp_get_attachment_image_src($image_id, array(580,244),true);
    $image_url = cs_attachment_image_src($image_id, 580, 232);

    featured();
    ?>
    ">
    <?php echo "<img src='".$image_url."' />";?>

    <?php }?>
    <div class="post-opts">
    <div class="date"></div>
    #comments"><?php echo get_comments_number($post->ID);?>
    <div class="title">
    <h3>"><?php echo get_the_title();?></h3>

  2. alchymyth
    Forum Moderator
    Posted 9 months ago #

    the above code is not usable -
    please post your code again and mark it properly - http://codex.wordpress.org/Forum_Welcome#Posting_Code

  3. Con91
    Member
    Posted 9 months ago #

    I dont really know what you mean, but this is also some code in relation to thumbnail post from the functions.php file.

    }
    function cs_get_post_img($post_id, $width, $height){
    	//if ( has_post_thumbnail()) {}
    	$image_id = get_post_thumbnail_id($post_id);
    	$image_url = wp_get_attachment_image_src($image_id, array($width,$height),true);
    	if ( $image_url[1] == $width and $image_url[2] == $height ) {
    		return get_the_post_thumbnail($post_id, array($width, $height));
    	}
    	else {
    		return get_the_post_thumbnail($post_id,"full");
    	}
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Reply

You must log in to post.

About this Topic