Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi cookingwithlei,

    Do you have a live link to your website? Themes implement the ‘featured image’ functionality using various methods.

    Thread Starter cookingwithlei

    (@cookingwithlei)

    yes, here is the link: cookingwithlei.com

    Thanks

    If you would like to remove it from all post areas:

    edit: content.php, content-page.php, content-archive.php:

    Find:

    <?php ct_founder_featured_image(); ?>

    Change to:

    <?php //ct_founder_featured_image(); ?>

    What we are doing with // is commenting out the php function which is grabbing the featured image.

    Thread Starter cookingwithlei

    (@cookingwithlei)

    Thanks, but the featured images on the main page disappear too.

    To clarify, do you just want to hide the featured image from the full single page posts? (example: when a user clicks on a posts and you are brought to the full post)

    If that is what you are looking for and still want the featured image to show in all other areas:

    Edit content.php and content-page.php:

    <?php //ct_founder_featured_image(); ?>

    and set content-archive.php to:

    <?php ct_founder_featured_image(); ?>

    Thread Starter cookingwithlei

    (@cookingwithlei)

    Yes, I still want the featured images on the front page, but not in the full single posts.

    I removed // from content-archive.php, but still doesn’t work.

    Don’t know why I wasn’t making this more simple. Crossing over between themes.

    To make this edit remove all the // comments we added to content.php, content-page.php, and content-archive.php. This brings us back to how it all was original set.

    Now go to your functions.php and find:

    if ( ! function_exists( 'ct_founder_featured_image' ) ) {
    	function ct_founder_featured_image() {
    
    		global $post;
    		$featured_image = '';
    
    		if ( has_post_thumbnail( $post->ID ) ) {
    
    			if ( is_singular() ) {
    				$featured_image = '<div class="featured-image">' . get_the_post_thumbnail( $post->ID, 'full' ) . '</div>';
    
    			} else {
    				$featured_image = '<div class="featured-image"><a href="' . esc_url( get_permalink() ) . '">' . get_the_title() . get_the_post_thumbnail( $post->ID, 'full' ) . '</a></div>';
    			}
    		}
    
    		$featured_image = apply_filters( 'ct_founder_featured_image', $featured_image );
    
    		if ( $featured_image ) {
    			echo $featured_image;
    		}
    	}
    }

    Here you will see:

    if ( is_singular() ) {
      $featured_image = '<div class="featured-image">' . get_the_post_thumbnail( $post->ID, 'full' ) . '</div>';
    
    }

    All we want to do is comment out:

    $featured_image = '<div class="featured-image">' . get_the_post_thumbnail( $post->ID, 'full' ) . '</div>';

    and change it to:

    //$featured_image = '<div class="featured-image">' . get_the_post_thumbnail( $post->ID, 'full' ) . '</div>';

    This should only disable the image for the featured-image on single posts.

    Thread Starter cookingwithlei

    (@cookingwithlei)

    super! I reloaded the theme and it works now.

    Thanks so much for your time!!

    Lei

    Glad it all worked out!

    Please mark this post as resolved. Thanks!

    Thread Starter cookingwithlei

    (@cookingwithlei)

    Sorry, one more question. how to make the images on the posts bigger?

    If you want the images on the single pages to expand 100% of the container width:

    Edit: style.css

    Find:

    img,
    .alignright,
    .alignleft,
    .aligncenter,
    .alignnone,
    .size-auto,
    .size-full,
    .size-large,
    .size-medium,
    .size-thumbnail {
      max-width: 100%;
      height: auto;
    }

    And below it add:

    img.aligncenter {
      width: 100%;
    }

    So any img tag with .aligncenter will expand to 100% of its container now.

    Thread Starter cookingwithlei

    (@cookingwithlei)

    The code is:

    img,
    .alignright,
    .alignleft,
    .aligncenter,
    .alignnone,
    .size-auto,
    .size-full,
    .size-large,
    .size-medium,
    .size-thumbnail {
    max-width: 100%;
    height: auto;
    }
    img.aligncenter {
    width: 100%;
    }

    but it doesn’t make a difference as the page is not wide enough, the images have reach the 100% width of the post.

    Thread Starter cookingwithlei

    (@cookingwithlei)

    I figured out myself to edit style.css

    change 1400px to 1950px

    .max-width {
    //max-width: 1400px;
    max-width: 1950px;
    margin: 0 auto;
    }

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘remove featured image from posts’ is closed to new replies.