featured image on single post (3 posts)

  1. Con91
    Posted 2 years ago #

    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;

    $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);

    <?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. Michael
    Part-Time Forum Moderator
    Posted 2 years 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
    Posted 2 years 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.]

Topic Closed

This topic has been closed to new replies.

About this Topic