更新:Wordpress过期后代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更新:Wordpress过期后代码相关的知识,希望对你有一定的参考价值。

All you need to do when writing the post, is enter a custom field with the key "expiration" and set the value in the format: "2010/01/01 18:20:00" - this would expire the post at 6.20pm on the 1st January 2010.
  1. ***PUT THIS INSIDE THE LOOP, FIRST THING***
  2.  
  3. <?php //to check against expiration date;
  4. $timestamp = strtotime("now + 8 hours");
  5. $currentdate = date('YmdHis', $timestamp);
  6. $expirationdate = get_post_custom_values('expiration');
  7. if (is_null($expirationdate)) {
  8. $expirestring = '30005050235959'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;
  9. } else {
  10.  
  11. if (is_array($expirationdate)) {
  12. $expirestringarray = implode($expirationdate);
  13. }
  14. $markup = array("/",":"," ");
  15. $expirestring = str_replace($markup,"",$expirestringarray);
  16. } //else
  17. if (( $expirestring > $currentdate ) || (is_archive())) { ?>
  18.  
  19. ***THEN PUT THE FOLLOWING LINE AT THE VERY END OF THE LOOP***
  20.  
  21. <?php } //end if for expiration; ?>

以上是关于更新:Wordpress过期后代码的主要内容,如果未能解决你的问题,请参考以下文章

为啥我的word更新域后代码依然是代码,没有变成我想要的东西。

php 杀死WordPress自动更新的片段

PHP Wordpress - 删除更新唠叨和版本给所有人,但管理员(2个片段)

axios 500 内部服务器错误后代码执行停止

WordPress - 代码片段插件

Source Map调试压缩后代码