I am currently learning about creating and modifying themes for WP and I am stuck on this one thing. I see that there are a lot of people with similar problem but I didn't find a solution to mine.
The problem is that pages work fine and the content is displayed but the content of sub-pages (child-pages) are not found. I have created page with sub-page with content but wordpress just can't find it. Firstly I thought that its my theme problem but after switching to default themes (twenty fifteen,sixteen,seventeen) the result is the same so is it .htaccess problem? If so I have the default .htaccess and I never changed anything in it.
I also tried switching back and forth between permalink settings - same result.
To be clear, there is no error 404 just my
if ( have_posts() ) :
goes straight to else. Original themes if clause goes to else too.
Edit2: Thank you @BlueSuiter. Changing the slug of the parent fixed the problem. Switching it back made the problem again. Does anyone know why this happens and how to avoid it?