【问题标题】:Merge two php functions in a wordpress plugin在 wordpress 插件中合并两个 php 函数
【发布时间】:2013-01-25 17:26:19
【问题描述】:

我正在使用日历插件,我想更改一件事

有一个添加事件名称的php函数:

包括/日历/Calendar.class.php

$tab .= '<div class="namevent"> '.$event['event'].'</div>';

输出:我的活动名称

我想在活动标题中加一个TIME,找了一会儿发现里面有时间功能

public/events.php

if(!empty($custom['stime'][0]))
                            echo '<br /><strong>'.$home[16].':</strong> '.$custom['stime'][0].' ';

if(!empty($custom['etime'][0]))
                            echo '<strong>'.$home[17].'</strong> '.$custom['etime'][0];

输出:10:00 到 11:00(假设你的活动时间是这些)

然后我尝试了这个:

$tab .= '<div class="namevent"> '.$custom['stime'][0].' - '.$custom['etime'][0].' '.$event['event'].'</div>';

期望输出为:10:00 - 11:00 我的活动名称

但是没有用;

我做错了什么?

非常感谢!

【问题讨论】:

  • 请添加Wordpress插件的名称..
  • 对不起:3C-Events : Wordpress All-in-One Event Calendar(我认为 Gaaks 有这个插件)codecanyon.net/item/3cevents-wordpress-allinone-event-calendar/…
  • 那是CodeCanyon,如果你买了物品,可以直接问作者。。我想这里没有很多人可以帮助你,我们没有没有购买物品的API ..您可以在author support forum询问。
  • 啊...至少我的方法是对的吗? ._.

标签: php wordpress scripting merge calendar


【解决方案1】:

确保$custom['stime'][0]$custom['etime'][0] 存在,每个都有var_dump()print_r()。 在导致错误的行之前添加以下代码:

var_dump($custom['stime']);  // Be sure the var is not undefined and [0] exists
var_dump($custom['etime']);

【讨论】:

  • 请删除您的pastie.org 粘贴,作者不会高兴。顺便说一句,您可以在图像中看到您只有NULL 值,所以$custom['stime']$custom['etime'] 是空值。那是你的问题。也可以试试var_dump($custom);
  • 正确,已删除评论。 var_dup($custom);仍然导致 NULL :/
  • 是的,所以您必须阅读文档并使用存在的变量。如果我是对的,请将 $custom 更改为 $event
猜你喜欢
  • 1970-01-01
  • 2011-09-05
  • 2011-02-22
  • 1970-01-01
  • 2020-06-14
  • 2018-02-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多