How to Add Featured Images or Post Thumbnails in WordPress

December 13, 2018
Featured Images or Post Thumbnails

 In this post, we are talking about how to get posts and feature images in your simple template pages because if you are a beginner definitely are facing a problem customizing a simple template page so we are going to create some PHP loops to get a post, description, title, feature images and all.  



Step-1. In this first step, we create a simple PHP array and while loop code.

  

Step-2.  In this second step, we are creating some  PHP code to get the title of posts and put the code in your HTML  where you want to show the title. One thing is highly recommended please write the whole code inside the while loop.

                             <?php the_title(); ?>                 //this is title code 

Step-3. In the third step, we are creating PHP code to get feature Images of posts and Descriptions.  The codes in your HTML where you want to show the title. One thing is highly recommended please write the whole code inside the while loop.
  •                            <?php echo $feat_image;  ?>    //this is freature image code                                                                     
  •                              <?php the_excerpt();?>           // this is description code
                       
Step-4. In this fourth step, we are creating PHP URL code to get the URL of any pages.
                     <?php the_permalink();?>     // this is URL code

Step-5. In this step, we provide all code and show how to put PHP code in our HTML file inside the loop.