duadlkc5762218 2013-08-20 10:01
浏览 73
已采纳

是否可以在single.php中更改HTML?

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?

  • 写回答

2条回答 默认 最新

  • douhan1860 2013-08-20 10:28
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部