I've got a series of images as posts, generated by the loop. As you can see here. Once you click on an image, it takes you to a single post page.
I need to alter the HTML on the single post page only. Is this possible?
I've got a series of images as posts, generated by the loop. As you can see here. Once you click on an image, it takes you to a single post page.
I need to alter the HTML on the single post page only. Is this possible?
收起
Yes, you can.
Here's how WordPress finds which file to use when displaying a single post:
single-{post-type}.php > single.php > index.php
So, first WP will look in the theme for single-{post-type}.php
. Which it will use for a specific type of post. If no such file exists then it will look for a single.php
. Which WP will use for displaying all single posts. If no such files exists then it will fallback on your index.php
file to display single posts.
So, either create a single-{post-type}.php
or a single.php
and add your modified HTML there.
报告相同问题?