admin管理员组文章数量:1130349
How can I add a bubble that says "new content" to all posts within the last week? I have looked at all available solutions but they only appear to be for menu items.
thanks in advance.
How can I add a bubble that says "new content" to all posts within the last week? I have looked at all available solutions but they only appear to be for menu items.
thanks in advance.
Share Improve this question asked Dec 11, 2018 at 2:04 JeffJeff 11 Answer
Reset to default 0<?php if( date('U') - get_the_time('U', $post->ID) < 24*60*60 ) : ?>
<div class="bubble"><?php _e('NEW', 'mytheme_name'); ?></div>
<?php endif; ?>
the above one will show NEW div for each post posted in 24 hours. You can simply add anywhere in your posts loop.
You can use 7 * 24 * 60 * 60 to make it weekly. More info about php time is here.
How can I add a bubble that says "new content" to all posts within the last week? I have looked at all available solutions but they only appear to be for menu items.
thanks in advance.
How can I add a bubble that says "new content" to all posts within the last week? I have looked at all available solutions but they only appear to be for menu items.
thanks in advance.
Share Improve this question asked Dec 11, 2018 at 2:04 JeffJeff 11 Answer
Reset to default 0<?php if( date('U') - get_the_time('U', $post->ID) < 24*60*60 ) : ?>
<div class="bubble"><?php _e('NEW', 'mytheme_name'); ?></div>
<?php endif; ?>
the above one will show NEW div for each post posted in 24 hours. You can simply add anywhere in your posts loop.
You can use 7 * 24 * 60 * 60 to make it weekly. More info about php time is here.
本文标签: New Post bubble
版权声明:本文标题:New Post bubble 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749109760a2317181.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论