doulv1760 2014-02-04 22:54
浏览 31

添加天到今天(widget wordpress)

I want to create a widget in WP showing "today date" + 1 to 3 days.

For delivery of products, it would show like this : Delivery time expected between date+1day and date+3days.

I would insert code in html widget.

Here is what I tried :

<?php $i=1;echo $date = strtotime(date("d-m-Y", strtotime($date)) . " +".$i."days"); ?>

But it doesnt show anything... maybe edit functions.php.

OK am bad.

  • 写回答

1条回答 默认 最新

  • dow72046 2014-02-04 22:59
    关注

    If you are using PHP to do this, you're almost there:

    $oneDay = date("d-m-Y", strtotime("+1 day"));
    $threeDays = date("d-m-Y", strtotime("+3 days"));
    

    So to echo it out:

    echo "Delivery time expected between $oneDay and $threeDays.";
    

    Remember that strtotime() returns a UNIX timestamp (like 130000485), while date() formats the timestamp using the string you provide, e.g. "d-m-Y" (like 04-02-2014 for today).

    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题