Hello! So I am trying to make a theme from scratch for the first time (using a tutorial) and I want the blog posts to appear under site.com/blog. I have obviously tried going to wordpress settings > reading and set it as posts page. I got it to work by going to site.com/category/blog but for SEO purposes I still want it to be site.com/blog. I know I am putting the code in the wrong place (wrong .php file) but cannot figure out where it should be.
Are you wanting to show the blog posts on the /blog page? If so, you first go to the WordPress permalinks section and make sure that the permalinks are formatted for site.com/page format. That would be Settings > Permalinks > Post name.
Your next step would be to create a new page and make sure the permalink reads site.com/blog.
In this new file you can build out your blog page including having your standard blog “loop” for looping through blog posts.
Once you have the template developed, upload it to your sites theme folder and then go to your new blog page. Now on the right side you will see a place where you can select a template. The drop down should now show you the new template you uploaded. Select the template and save the page.
It sounds like a lot, but it is rather easy really. The time consuming part is just building the template file itself to make it look how you want it. But once you have this template setup, you can assign it to any page you want.
It might be beneficial to just read the entire Page templates page I pointed to above and that should give you all the steps you need to make sure your blog posts show up on a given page. I hope this is what you are looking to do.
Hello! Thanks for the response! Ok so I did what you recommended and still no joy. This is strange and hard to explain but I can create the page and set the blog template to it and go to the /blog page and it works mostly, but does not show the posts. When I designate the /blog page under settings > reading as the posts page it becomes all white (blank).
Here is my code for the template named template-blog.php
<!-- This is the blog page template -->
<?php
/*
* Template Name:Blog
* */
?>
<?php get_header(); ?>
<!-- The following puts the blog sidebar to the left of the content. This is different than the other templates made -->
<section class="page-wrap">
<div class="container">
<section class="row">
<div class="col-lg-3">
<?php if(is_active_sidebar('blog-sidebar')):?>
<?php dynamic_sidebar('blog-sidebar');?>
<?php endif;?>
</div>
<div class="col-lg-9">
<!-- Puts in wordpress user's title-->
<h1><?php the_title(); ?></h1>
<!-- Retrieves wordpress user content-->
<?php get_template_part('includes/section', 'content'); ?>
</div>
</div>
</section>
</div>
</section>
<!-- Retrieves footer from wordpress -->
<?php get_footer(); ?>