WordPress how to make a default page template

Hi, in this WordPress common page template development we are going to learn to create the default page template the page.php file for WordPress theme development. If you are not going to select any page template from WordPress admin panel while creating a page then the page.php file the default page template will be called for showing or displaying the page. Now start to develop the default page template step by step.

Step 1. Select an HTML page that is used in most of the pages.

Step 2. Now remove the common Header, Footer and sidebar portion

Step 3. Save the file as page.php file in your theme folder as page.php file.

Step 4. Get the Header, Footer, Sidebar template in the page.php files.

  1. To get Header template use the code
  2. To get Footer template use the code
  3. And to get Sidebar template use the code

Step 5. Now after get the post content entered for the page, and for that use the code

 

Step 6. After getting all the post content have to get the title , content and featured image for the page. To print the title use the code the title can be stored in variable also for that use the code Similarly to to print the content use the code the content can be get in variable also and for that use the code And for the featured image I am advice to get the link location of the image as if you have to use some special class or id for the image like img-responsive then need to get the location and for that use the code

”<?php echo wp Get Attachment Url( get Post Thumbnail Id($post ID)); ?>” />

 

Now I am going to show the sample code for the page.php file.

 

”<?php echo wp Get Attachment Url( get Post Thumbnail Id($post ID)); ?>” alt=”” />

 

And you have created the default page template the file page.php and if not selected any page template while creating a page form WordPress admin panel the age will be used to display the content of the page.

Next, we are going to learn about the Develop WordPress custom page template contact us page with contact form using contact form 7 plugin

 

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.