How to make Home Page in WordPress Custom Theme.

Design your website’s homepage with easy steps. Manage your home page without any plugins, Just use this simple code in your custom theme.

How To

>> First of all open your hosting cpanel and go to theme folder.

>> Create new file name with page-home.php.

>> Then paste these code in page-home.php.

<?php
/**
Template Name: Home Page
*/
?>


<?php
get_header();
?>

<?php
// This is only for desktop
?>
<div class="maincolumnbg">
<div class ="content-container">
<div class="main-column-index-home"><!-- main-column -->

<div class="home-ads" >
<?php include("google_ads/responsive_ads_1.php"); ?>
</div>

<?php
// Define our WP Query Parameters
$the_query = new WP_Query( 'posts_per_page=6' ); ?>

<?php
// Start our WP Query
while ($the_query -> have_posts()) : $the_query -> the_post();
// Display the Post Title with Hyperlink
?>

<div class="home_itemspl">
<?php include("template_part/index_code.php"); ?>
</div>

<?php
// Repeat the process and reset once it hits the limit
endwhile;
wp_reset_postdata();
?>
<div class="home-ads-second" >
<?php include("google_ads/responsive_ads_2.php"); ?>
</div>

<div class="vynag-category-home">
<?php
// the query
$the_query = new WP_Query(array(
'category_name' => 'vyang',
'post_status' => 'publish',
'posts_per_page' => 1,
));
?>

<?php if ($the_query->have_posts()) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="cat_indexexcerpt_vyang">
<?php the_content(); ?>
</div>
<div class="vynag-category-home-more">
<a href="http://thekroyaard.com/category/hindi/vyang"> ---- More Vyang ---- </a>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>

<?php else : ?>
<p><?php __('No Vyang'); ?></p>
<?php endif; ?>
</div>

<div class="vynag-category-home">
<?php
// the query
$the_query = new WP_Query(array(
'category_name' => 'Shayari',
'post_status' => 'publish',
'posts_per_page' => 1,
));
?>

<?php if ($the_query->have_posts()) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="cat_indexexcerpt_vyang">
<?php the_content(); ?>
</div>
<div class="vynag-category-home-more">
<a href="http://thekroyaard.com/category/hindi/shayari/"> ---- More Shayari ---- </a>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>

<?php else : ?>
<p><?php __('No Vyang'); ?></p>
<?php endif; ?>
</div>
</div><!-- main-column -->
</div>
</div>

<?php
get_footer();
?>

>> Change according to use and Save this file.

>> Then go to page and create new page name HOME and select page Template.

>> Then go to settings and click on Reading.

howe to

>> Then select Home and Save.

Watch Video