Can't remove featured image from posts?

Homepage Community Forums Epik Theme Support Can't remove featured image from posts?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #14024
    JohnnyvanM
    Customer

      Hello,

      I added a featured image to posts an pages using this code:

      add_action( 'genesis_entry_header', 'single_post_featured_image', 15 );
      
      function single_post_featured_image() {
      	
      	if ( ! is_singular() )
      		return;
      	
      	$img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
      	printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img );
      	
      }

      It adds the featured image to post and pages. The problem is that I inserted a feature image into this post: http://www.test24.nl/hallo-wereld/ and now I can’t remove it. I removed it from the blogpost settings, but it stays their while it is removed.

      How is that possible?

      I can remove it from page and newer posts, but not from this particular one. Also, the featured image stays also in the ‘content archives’ (http://www.test24.nl/blog/) while the image is already removed.

      Kind regards

      #14025
      JohnnyvanM
      Customer

        I did some more testing and I know exactly what the problem is now:

        I seems it doesn’t matter if the post is created before the functions.php code or is created after the functions.php code. The problem is that if I click on add a featured image in the settings and upload a foto from my computer, than I can’t remove it. I mean, I can remove it, but it is still on the website while it’s not more in the blogpost settings.

        If I use a photo that is already on my website, than I can remove it and it doens’t show anymore on my website.

        Is there a fix for that?

        #14068
        Eric
        Customer

          What happens if you temporarily remove that code? Does it remove the image? (even if you don’t have it selected?)


          I create awesome sites for awesome people! Contact me if interested – ericsanchez1585@gmail.com

          #14075
          JohnnyvanM
          Customer

            Thank you for your response.

            I have removed the code and then the image disappears from the blogpost, but not from the ‘content archives’ (http://www.test24.nl/blog/).

            When I put the code back, then the image is again in the blogpost.

            #14085
            Eric
            Customer

              That looks like your Featured Image. Do you have that enabled in your settings somewhere? Check you Genesis Theme settings page to see if you have the Featured Image settings enabled. If you do, then that’s what enables the image to show on the blog page.


              I create awesome sites for awesome people! Contact me if interested – ericsanchez1585@gmail.com

              #14152
              JohnnyvanM
              Customer

                Thanks for the help Eric!

                I found out what the problem was: http://wpsites.net/web-design/prevent-genesis-2-0-archives-from-using-first-image-in-content-area-as-featured-image/

                By adding this code to functions.php de problem was solved:

                function remove_featured_image_archives( $post ) {
                  if( !has_post_thumbnail() )
                		$post = '';
                	return $post;
                }
                add_filter( 'genesis_pre_get_image', 'remove_featured_image_archives', 10, 3 );
              Viewing 6 posts - 1 through 6 (of 6 total)
              • The topic ‘Can't remove featured image from posts?’ is closed to new replies.