WordPress how to make index page the default front page

Hi, tody we are going to learn how to Develop WordPress Front Page an index.php file of default FrontPage for wordpress custom theme. If you have not selected any static front page then the indec,php file will be fetched as frontpage in wordpress.

Now write the code in index.php file if not created please create in your theme folder to cut the html please follow our Split The html into header footer sidebar etc tutorial

Now html code of index.php pices will be like

 
<!—headeera -->
<!—end headerà -->
<div class="container-fluid text-center">
<div class="row content">
<!—sidebarà -->
<!—end sidebarà -->
<div class="col-sm-8 text-left" style="color: green;">
<h1>main body</h1>
<h1>Welcome</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<hr>
<h3>Test</h3>
<p>Lorem ipsum...</p>
</div>
</div>
</div>
 
<!—footerà -->
<!—end footerà -->
 

Now use the code <?php get_header(); ?> to get the header portion of the wordpress theme

Then write <?php if(haveposts()): while(have_posts()):  the_post(); endwhile; endif; ?> to get the posts if any regarding the page

Then write <?php get_sidebar(); ?> to get the content of the sidebar.php file

And  then write <?php get_footer(); ?> function to get the content of the footer.php file

The total code will be like:

<!—headeerà --> 
<?php get_header(); ?> 
<?php if(haveposts()): while(have_posts()):  the_post(); endwhile; endif; ?> 
<!—end headerà --> 
<div class="container-fluid text-center"> 
<div class="row content"> 
<!—sidebarà --> 
<?php get_sidebar();  ?> 
<!—end sidebarà --> 
<div class="col-sm-8 text-left" style="color: green;"> 
<h1>main body</h1> 
<h1>Welcome</h1> 
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
 <hr> 
<h3>Test</h3> 
<p>Lorem ipsum...</p> 
</div> 
</div> 
</div>   
<!—footerà --> 
<?php get_footer();  ?> 
<!—end footerà -->
Normal html template

Normal html template

For the welcome note and its title you can use theme option and get the data and paste there, you van take help from out make theme option tutorial portion to create an theme option page and get the entered data.

In this post we have learned about the creation process of a index.php file of wordpress custom theme development next we will learn about Develop WordPress 404 page not found page

Thanks for Reading

Share The Post On -

  1. Sajan mondal says:

    Very helpfull and i got a proper suggestions from here.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.