WordPress主题开发: 制作文章页面single.php

single页面的制作

来源于:

https://www.cnblogs.com/tinyphp/p/5940678.html

可以调用的文章内容:

调用文章标题:<?php the_title(); ?>

调用文章内容:<?php the_content(); ?>

调用文章摘要:<?php the_excerpt(); ?>

调用作者姓名:<?php the_author(); ?>

调用文章发布时间:<?php the_time(); ?>

调用作者的Gravatar头像:<?php echo get_avatar( get_the_author_email(), 36 ); ?>

调用文章内容可以写:

<?php echo the_content();?>

但是这个wordpress会自动在段落上加上p,解决方法可以改为下面的写法

<?php 
$post=get_post(get_the_ID());
echo $post->post_content;
?>

 

post_author:(整数)文章作者的编号

post_date:(字符)文章发表的日期和时间(YYYY-MM-DD HH-MM-SS)

post_date_gmt:(字符)文章发表的格林尼治标准时间(GMT) (YYYY-MM-DD HH-MM-SS)

post_content:(字符)文章内容

post_title:(字符)文章标题

post_category:(整数)文章类别的编号。注意:该值在WordPress 2.1之后的版本总为0。定义文章的类别时可使用 get_the_category()函数。

post_excerpt:(字符)文章摘要

post_status:(字符)文章状态(publish|pending|draft|private|static|object|attachment|inherit|future)

comment_status:(字符)评论状态(open|closed|registered_only)

ping_status:(字符)pingback/trackback状态(open|closed)

post_password:(字符)文章密码

post_name:(字符)文章的URL嵌套

to_ping:(字符)要引用的URL链接

pinged:(字符)引用过的链接

post_modified:(字符)文章最后修改时间(YYYY-MM-DD HH-MM-SS)

post_modified_gmt:(字符)文章最后修改GMT时间(YYYY-MM-DD HH-MM-SS)

post_parent:(整数)父级文章编号(供附件等)

guid:(字符)文章的一个链接。注意:不能将GUID作为永久链接(虽然在2.5之前的版本中它的确被当作永久链接),也不能将它作为文章的可用链接。GUID是一种独有的标识符,只是目前恰巧成为文章的一个链接。

post_type:(字符)(日志 | 页面 | 附件)

 

 

常用:

发表于:<?php the_time('Y-h-d'); ?>
分类:<?php the_category(','); ?>
Typecho

Next.Mist for Typecho 模板发布

2018-12-16 23:55:56

插件

Wenprise Pinyin Slug - 转换中文为汉语拼音或英文翻译

2020-2-24 16:39:11

⚠️
Npcink上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。
无意侵害您的权益,请发送邮件至 1355471563#qq.com 或点击右侧 私信:Muze 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索