Add wordpress featured image

Add Tool

How to add wordpress featured image


How to add wordpress featured image

Maximum WordPress template support featured image. If your template don’t support featured image, your template don’t need to change. The featured image setup is very easy of any template. In this WordPress snippets section I will inform your how to add wordpress featured image easy way without changing your wordpress template or using any featured image plugin.

Add Featured Image WordPress

Simply add the below codes in functions.php file to add featured image wordpress template.

<?php

///Featured image start/////////////
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}

////feture image end///////////
?>

This code will active Featured image in dashboard like

 add wordpress featured image

Now copy and paste the following codes where you want to display featured image WordPress

<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array("class" => "alignleft post_thumbnail")); } ?>

Here 200 is image height and 160 is image width. You can change it with your own choice.I want to display thumbnail image at left side of every post so I placed it above the post content

<div class="featured">
<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array("class" => "alignleft post_thumbnail")); } ?>
</div>
<?php the_excerpt();?> <!--This line show all posts descriptions-->

Style of featured image.

In this last step we will add some css codes in our style.css file. So open your style sheet and write the codes below.

. featured img {
border: medium none;
float: left;
height: 160px;
margin: 5px 10px 5px 5px;
overflow: hidden;
width: 200px;
}

This enough for displaying WordPress featured image with your post and page in your WordPress site.


Tags: wordpress featured image, featured image wordpress, wordpress featured image url, wordpress set featured image, set featured image wordpress
Payza

About Masum Billah

How to add wordpress featured image Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer.


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: Add wordpress featured image


adf.ly