WordPress

推荐列表 站点导航

当前位置:首页 > 建站教程 > WordPress >

WordPress如何实现文章人性化时间格式?

来源:网络整理  作者:  发布时间:2020-12-16 06:36
个人感觉WordPress作为信息流方面不是非常友好的,需要满足项目需求从而实现WordPress文章人性化时间格式,从而大大...

}

//人性化时间格式

else{

elseif ($diff >= 86400) {

$days = round($diff / 86400);

}

$time = sprintf('%s 分钟前', $mins);

$mins = round($diff / 60);

这个功能还是非常具有实际意义的,既可以帮我们大大改善信息流界面的杂乱感,又可以留住访客,不至于白白流失。

elseif (($diff <= 86400) && ($diff > 3600)) {

$time = get_the_time(get_option('date_format'));

}

return $time;

function time_ago(){

if ($days <= 1) {

$hours = round($diff / 3600);

$time = sprintf('%s 天前', $days);

}

elseif( $days > 29){

个人感觉WordPress作为信息流方面不是非常友好的,需要满足项目需求从而实现WordPress文章人性化时间格式,从而大大提升信息流站点的用户体验,那么WordPress如何实现文章人性化时间格式?

$from = get_the_time('U')- 28800 ;

//在需要调用的地方加入下方代码

if ($hours <= 1) {

if ($mins <= 1) {

$time = sprintf('%s 小时前', $hours);

}

$days = 1;

}

}

$mins = 1;

<?php echo time_ago(); ?>

将下方代码添加进function即可实现:

add_filter('the_time','time_ago');

$time = sprintf('%s 天前', $days);

$diff = (int) abs($to - $from);

global $post ;

}

}

if ($diff <= 3600) {

$to = time();

WordPress如何实现文章人性化时间格式? (https://www.wpmee.com/) WordPress使用教程 第1张

$hours = 1;

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/wp/4352.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

WordPress如何实现文章人性化时间格式?

2020-12-16 编辑:

}

//人性化时间格式

else{

elseif ($diff >= 86400) {

$days = round($diff / 86400);

}

$time = sprintf('%s 分钟前', $mins);

$mins = round($diff / 60);

这个功能还是非常具有实际意义的,既可以帮我们大大改善信息流界面的杂乱感,又可以留住访客,不至于白白流失。

elseif (($diff <= 86400) && ($diff > 3600)) {

$time = get_the_time(get_option('date_format'));

}

return $time;

function time_ago(){

if ($days <= 1) {

$hours = round($diff / 3600);

$time = sprintf('%s 天前', $days);

}

elseif( $days > 29){

个人感觉WordPress作为信息流方面不是非常友好的,需要满足项目需求从而实现WordPress文章人性化时间格式,从而大大提升信息流站点的用户体验,那么WordPress如何实现文章人性化时间格式?

$from = get_the_time('U')- 28800 ;

//在需要调用的地方加入下方代码

if ($hours <= 1) {

if ($mins <= 1) {

$time = sprintf('%s 小时前', $hours);

}

$days = 1;

}

}

$mins = 1;

<?php echo time_ago(); ?>

将下方代码添加进function即可实现:

add_filter('the_time','time_ago');

$time = sprintf('%s 天前', $days);

$diff = (int) abs($to - $from);

global $post ;

}

}

if ($diff <= 3600) {

$to = time();

WordPress如何实现文章人性化时间格式? (https://www.wpmee.com/) WordPress使用教程 第1张

$hours = 1;

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/wp/4352.shtml

相关文章

风云图片

推荐阅读

返回WordPress频道首页