I am developing a custom wordpress theme ( first time) , I have created below files and they work fine by following this tutorial.
index.php
header.php
footer.php
single.php
sidebar.php
Now issue is when I click on a category name at home page it show me 404 error, I tried to create category.php but still same issue. here is my index.php which I used for category.php
<?php get_header(); ?>
// other html stuff and loop
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php endwhile;?>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
I have two question:
- Is it really require to create category.php or can we use index.php for same purpose to show posts from category or tags?
- If it's require to create category.php, Do I also need to create tags.php and how will I get posts for those?
index.php
will act as a catchall ifcategory.php
does not exist. – Mathew Tinsley