Trying to solve this issue for the past hour and I can’t figure out what’s going on.
Trying to create single-blog.php
(I have a few posts which are under the category ‘blog’) but WordPress automatically redirects these posts to single.php! I’ve flushed the permalinks by settings > permalink > save changes but still nothing happens. To test & to see if WordPress picks up on single-blog.php the code I used was:
<?php get_header(); ?>
<h1>TEST HERE</h1>
<?php get_footer(); ?>
Read Template Hierarchy article in the codex, especially pay attention to Single Post Display part.
As you can see you have only three options:
single-{post_type}.php
single.php
index.php
It means that you can’t create a template for posts related to
blog
category. So you shouldn’t usesingle-blog.php
template, usesingle.php
instead and add there something like this: