WordPress自定义文章模板插件:Custom Post Template

大家都知道,WordPress发布页面(Page)时支持选择页面模板,那么,如果发布文章也可以选择文章模板,那该是多好的事啊!今天倡萌介绍的 Custom Post Template 和 Single Post Template 插件就可以实现这个功能!

Custom Post Template

Custom Post Template 是一个WordPress自定义文章模板插件,通过它,你可以制作不同的文章模板文件(类似于 single.php),然后根据不同类型的文章,选择不同的模板文件,是不是很酷?

1.在后台插件安装界面搜索 Custom Post Template 即可在线安装,后者下载 Custom Post Template

2.复制主题的 single.php 文件的代码,在其顶部添加类似下面的代码:

<?php
/*
Template Name Posts: wpdaxue
*/
?>

另存为其他文件名,比如 single-wpdaxue.php (存放位置和 single.php 相同,即主题的根目录),第 3 行冒号后面的 wpdaxue 就是模板名称,你可以自己修改。然后在发布文章时,就可以选择改模板文件:

custom-post-template-wpdaxue_com

当然了,要想实现不同的文章样式,你就要自己修改自定义的文章模板文件了。

Single Post Template

Single Post Template 和 Custom Post Template 类似,只是文章模板文件的写法不一样,使用的是:

<?php
/*
Single Post Template: wpdaxue
*/
?>

在后台插件安装界面搜索 Single Post Template 即可现在安装,或者下载 Single Post Template

来源:

https://www.wpdaxue.com/custom-post-template.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32768.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?