I created a WordPress theme with one page design format which means I wrote all the code in the main index.php file. Now I need to make a different page with separate URL but for some reason it still displays the same content.
Basically is the main page and I need to have a new separate page for some content like but for some reason whenever I create a new page it still shows the content from the main page.
I don't know what's the WordPress way of doing things like that, should I just create a new directory with new files?
I created a WordPress theme with one page design format which means I wrote all the code in the main index.php file. Now I need to make a different page with separate URL but for some reason it still displays the same content.
Basically https://mypage is the main page and I need to have a new separate page for some content like https://mypage/something but for some reason whenever I create a new page it still shows the content from the main page.
I don't know what's the WordPress way of doing things like that, should I just create a new directory with new files?
Because the naming convention is matter. You can create a new template for your different page and name it "page.php" and on the header portion give it a name:
<?php
/**
* Template name: Different page tempate
*/
get_header(); ?>
<div class="yourclass">
<!-- Your different template code should go here -->
</div>
<?php
get_footer();
Once you are done then go to Pages>Add New & on the right sidebar you will see the new template name under "Template" dropdown. Select it as your new page template and publish.