Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Moses Williams III
Moses Williams III
28,802 Points

How do I remove images from my Wordpress post (above the text) so that I only have the image inside the post?

Need to remove images automatically generated above text when post is made. I have already used hide image plugin and hide title. Thank you for your help!

4 Answers

Moses,

Step 1 is to verify what's inserting the image. Do you know what's doing that? It's almost certainly a plugin.

Moses Williams III
Moses Williams III
28,802 Points

Do you think it has to do with me using visual composer? Also when I tried to edit the php in the editor to check if there were any conditions that caused this to happen automatically, it just showed a framework file and not the post php file?

Moses,

It's unlikely that someone can help you solve this remotely, especially if you're using a custom theme with Visual Composer. VC adds all sorts of abstraction, and folks won't know what custom features your theme has that might be causing the auto-inserted image. It could also be a plugin (or a Visual Composer add-on, there are many of those), so it's quite a can of worms.

Hi Moses,

From what you describe this may well be the featured image you are setting being used.

If so a good theme will simply not display anything if the featured image is not set at all. Let me know if this is not the case. If the site is live by all means point me at the site and I can take a closer look :)

Craig

Moses Williams III
Moses Williams III
28,802 Points

Hi Craig,

Thank you for your response. The feature image is set to nothings and I have even used a "hide image" plugin. I'm thinking two things. One there is a conditional in the functions.php that allows this image that was used in a blog post to appear below the master head in every post. Or maybe i need to look into making a child theme? Thanks for all thr help and support.

-and sorry it is not live, due to this issue

Hi Moses,

Could you tell me what theme you are using? Maybe I can h stick a black version on a local install and help to see what is going on :)

Craig

Moses Williams III
Moses Williams III
28,802 Points

Innovation Construction and building :)

Moses

Hi Moses on which page are the images coming in that you are not expecting to see?

For example, you have created an about page and for no reason there is a background image behind the page title?

Some thing like that, just need a little more detail.

Craig

Moses Williams III
Moses Williams III
28,802 Points

Hi Craig,

I have created a blog page...ex http://www.example.com/blog. This page holds a main image right below the header and above the text displaying the blogs. When I click on the picture it is linked to the first blog post containing that same picture inside of the post next to the text...this was done in visual composer. I have tried going to the editor to see if there was a php condition that added this thumbnail when a post is created, but I think visual composer has some automatic generation in it's framework. Thanks for all the help, I really appreciate it! :)

-Moses

Are these images in your media folder? what is the path of the img in the dev tools? and as a last resort, you can find the img id or class and in your css have display none call on the img/imgs.

Moses Williams III
Moses Williams III
28,802 Points

Can I show you php conditions that I found for the thumbnail? I think removing one of these will fix the problem. Thank you :)

''' php if (!function_exists('g5plus_post_thumbnail')) { function g5plus_post_thumbnail($size) { $html = ''; $prefix = 'g5plus_'; switch(get_post_format()) { case 'image' : $args = array( 'size' => $size, 'format' => 'src', 'meta_key' => $prefix.'post_format_image' ); $image = g5plus_get_image($args); if (!$image) break; $html = g5plus_get_image_hover($image, get_permalink(), the_title_attribute('echo=0'),get_the_ID()); break; case 'gallery': $images = g5plus_get_post_meta(get_the_ID(), $prefix.'post_format_gallery'); if (count($images) > 0) { $data_plugin_options = "data-plugin-options='{\"singleItem\" : true, \"pagination\" : false, \"navigation\" : true, \"autoHeight\" : true}'"; $html = "<div class='owl-carousel' $data_plugin_options>"; foreach ($images as $image) { $src = wp_get_attachment_image_src($image, $size); $image = $src[0]; $html .= g5plus_get_image_hover($image, get_permalink(), the_title_attribute('echo=0'),get_the_ID(),1); } $html .= '</div>'; } else { $args = array( 'size' => $size, 'format' => 'src', 'meta_key' => '' ); $image = g5plus_get_image($args); if (!$image) break; $html = g5plus_get_image_hover($image, get_permalink(), the_title_attribute('echo=0'),get_the_ID()); } break; case 'video': $video = g5plus_get_post_meta(get_the_ID(), $prefix.'post_format_video'); if (count($video) > 0) { $html .= '<div class="embed-responsive embed-responsive-16by9 embed-responsive-' . $size . '">'; $video = $video[0]; // If URL: show oEmbed HTML if (filter_var($video, FILTER_VALIDATE_URL)) { $args = array( 'wmode' => 'transparent' ); $html .= wp_oembed_get($video, $args); } // If embed code: just display else { $html .= $video; } $html .= '</div>'; } break; case 'audio': $audio = g5plus_get_post_meta(get_the_ID(), $prefix.'post_format_audio'); if (count($audio) > 0) { $audio = $audio[0]; if (filter_var($audio, FILTER_VALIDATE_URL)) { $html .= wp_oembed_get($audio); $title = esc_attr(get_the_title()); $audio = esc_url($audio); if (empty($html)) { $id = uniqid(); $html .= "<div data-player='$id' class='jp-jplayer' data-audio='$audio' data-title='$title'></div>"; $html .= g5plus_jplayer($id); } } else { $html .= $audio; } $html .= '<div style="clear:both;"></div>'; } break; default: $args = array( 'size' => $size, 'format' => 'src', 'meta_key' => '' ); $image = g5plus_get_image($args); if (!$image) break; $html = g5plus_get_image_hover($image, get_permalink(), the_title_attribute('echo=0'),get_the_ID()); break; } return $html; } }'''

if you are going to post a lot of code you will need to format it so we can read your post. What you posted is one minimized php file. I can not read it.