I'm facing a big issue with the right way of implementing the static page in Wordpress. I've read almost for 5 days along now, and still can't figure out how it (should) work.
The problem i'm facing is as followed:
When I make use of the option "show latest posts" in customizer, I see the front page as it should be. I got the text of the homepage followed by the latest posts. The problem I'm facing here, is the homepage text is hard coded in my home.php. I want to be able to change that on the input field of the home in my wordpress editor.
So I understood i should make use of the index.php and create a page called "Home" and a page called "Blog". I set those pages as static page, and i'll be able to accomplish what I want. But i don't. I just can't get it done.
So I tried it with a complete new installation of WP in my local machine. Setup a brand new installation, created just 2 pages (home and blog). Go to Settings-> Reading -> Set static page: Homepage: Home Post page: Blog. Saved changes.
Got to the homepage and i just saw my homepage. No posts up there.
What am i missing here?
You are using a page called "Home" which is empty. It's expected and is fine. What you really need is to create a custom template (https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use), and create any custom layout you want
Extended Answer
Create a template called homepage.tpl.php for example. Put this code inside:
<?php
/**
* Template Name: Custom Homepage
*/
get_header(); ?>
<div>
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
the_content();
endwhile;
endif;
?>
</div>
<div>
<?php
$wp_query = new WP_Query(array(
'post_type' => 'post',
'post_status' => 'publish'
));
if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) : $wp_query->the_post();
the_title();
/* Post loop content goes here */
endwhile;
wp_reset_postdata();
endif;
?>
</div>
<?php get_footer(); ?>
Go the admin panel -> pages -> click edit "home". At the right sidebar select the template called "Custom Homepage". That's it.