I'm just starting learning wordpress. I decided to go with the underscores starter theme to develop my own custom theme. And I've got some questions.
I suppose there is an answer to my question in the docs, but it seems like too much information to study at the first time. I'm just getting confused more. So I need a direct and clear answer to help me dive in the docs then with a primary understanding.
The question is:
I've installed the underscores theme on my wordpress site.
After this, I've created two pages (page1 and page2).
I've assigned page1 as my front page and page2 as my posts page then.
The index.php file contains the following code:
get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php if ( have_posts() ) : if ( is_home() && ! is_front_page() ) : ?> <header> <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1> </header> <?php endif; /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'template-parts/content', get_post_format() ); endwhile; the_posts_navigation(); else : get_template_part( 'template-parts/content', 'none' ); endif; ?> </main><!-- #main --> </div><!-- #primary -->
But when I enter mysite.com/index.php, there's no posts on the page (but the code must extract them, as I understand). There is the text I've entered while creating the page only.
And the page2 (which is located at mysite.com/page2/) doesn't show the title and the posts navigation.
So I don't understand:
1) Why when I'm adressing mysite.com/index.php I see the text I've entered while creating the page, but there's no code for that in the index.php file?
2)Why the single_post_title() function doesn't return something?
3) Where's the post navigation? There's code for that in the index.php file
4) Are the posts page and the home page are the same pages?
5) How does the index.php file work? It controls the front page and the post page (and maybe some more pages) at the same time? I don't get it.
Thanks in advance!