How to How to remove first image from post wordpress

wordpress tutorial, remove first image from post wordpress. In many wordpress old site they used the first image as post or featured image. Here solution. while showing the single post they not want to show the first image which is uploaded.

How to remove first image from post wordpress

How to remove first image from post wordpress
How to remove first image from post wordpress

Using following code you can remove the first image from wordpress post. Please put following code in to functions.php file (you will find this file in your theme folder)


function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');

when you see the single page of blog then you will not see the first image from blog post.

 

how to add post thumbnail on homepage in wordpress

Many times many wordpress blog and website users asked me about adding the post thumbnail on home page. Many people download the free themes from internet and they want to add the post thumbnail on homepage. In this tutorial I will tell you how to add post st thumbnail on homepage.

how to add post thumbnail on homepage in wordpress

First step open your functions.php file from wordpress theme folder and add following code in that file.


add_theme_support( 'post-thumbnails' );

Then open your index.php file and find the the_content or the_excerpt text. If you not find this text in this file then open your loop.php file from wordpress theme folder and find the_content or the_excerpt in that file. Before this tag you need to put following code in that file.


<div class="imgshadow"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(500,400), array('class' => 'imgshadowleft')); ?></a></div>

You need to specify your thumbnail size Here I chosen 500×400 size for me. Normally people choose the 150×150 or 200×200 size. After that use following css code for styling.

put following code in your style.css file.


.imgshadow{float:left; margin-right:5px}

How to set post thumbnail for home page?

Go to wordpress admin panel and create new post. you will find the “Featured Image” section bottom on right side panel. Click on “Set featured image” link.

how to add post thumbnail on homepage in wordpress
how to add post thumbnail on homepage in wordpress

Then you need to upload the image and you will find option called “use as featured image” link. Just click on that image. For help you can refer following image.

This way you can easily add the post thumbnail to your home page. For more information about wordpress thumbnail image you can read the following articles. In following you can got very detailed information about wordpress thumbnail and featured images.

Show Post Thumbnail or Featured image in WordPress RSS Feed

Add the Custom Thumbnail Size to wordpress

How to set post first image as featured image automatically

How to use the the_post_thumbnail In WordPress 3.0