How to create a WordPress custom page template for blog the post list

Hi, we are going to learn WordPress blog template post loop development, as WordPress is mainly used for blogging so there must have to a blog template for showing the posted blog.

Now start to create the blog template step by step

develop wordpress blog template

develop a WordPress blog template

First, there is two way to make a blog page

  1. you can go to the admin panel and go to appearance ->customize->and chose a post page,
  2. and the second one is to make a custom page template for blog and after creating the page link the template for showing the page,

I will show the second one by creating a blog template and will display the blogs

Step 1

Take an HTML design and create a page inside your theme folder and paste the HTML

example: template_blog.php

Step 2

now place header, footer, and sidebar template of WordPress theme in its position by using the code
, and and get the page content by using with a template name.

the code will be like





 

Step 3

Now create the post loop with argument and get the title, excerpt and featured image and the permalink

Example:

$args = array(
'post_type' => 'home_non_veg_menu',
'order' => 'DESC',
'posts_per_page' => -1,
);
query_posts( $args );
// The Loop
$counter = 0;
if ( have_posts() ) :
while(have_posts()) :
//the post for declaration
the_post();

?>

<?php Echo wp Get Attachment Url( Get Post Thumbnail Id($post >ID));  ?> Read More

 

Step 4

Now we have the full code for making the template

Now the full code for making the blog template for WordPress is:

template_blog.php (inside theme root folder)



       
       
          'home_non_veg_menu',  'order' => 'DESC', 'posts_per_page' => -1,   ); query_posts( $args ); // The Loop   $counter = 0;   if ( have_posts() ) : while(have_posts()) :    //the post for declaration   the_post(); ?>  

  <?php Echo Wp Get Attachment Url( Get Post Thumbnail Id($post >ID));  ?>     Read More          
       
                     
   
   

Now we have created the blog template and its ready for displaying the posts.

Thanks for reading

Share The Post On -

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.