这段代码在我的WAMP localhost上工作,但在Godaddy服务器上不工作,我检查了php版本,它们是一样的,很难弄清楚问题是什么。有人有建议吗?谢谢
网站:http://www.thearcticplayhouse.com
<div id="index-row3" class="widthfull clearfix">
<img src="<?php print IMAGES; ?>/upcoming_events.png" title="Arctic playhouse shows" class="alignleft upcoming"/>
<div class="wrapper-events width100 alignleft">
<?php
global $post;
// Retrieve the next 5 upcoming events
$date = new DateTime();
$events = tribe_get_events( array(
'posts_per_page' => 5,
'start_date' => strtotime($date->format('Y-m-d'))
) );
foreach ( $events as $post ) {
setup_postdata( $post );
$tribeDate = tribe_get_start_date();
$displayDate = explode(" ", $tribeDate);
?>
<article id="event-<?php the_ID(); ?>" <?php post_class(); ?>>
<div id="event-post" class="alignleft">
<div class="alignleft">
<ul class="event-date">
<li class="month"><?php echo substr($displayDate[0], 0, 3); ?></li>
<li class="day"><?php echo $displayDate[1]; ?></li>
<li class="event-time"><?php echo $displayDate[2]; ?> <?php echo $displayDate[3]; ?></li>
</ul>
</div>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div id="event-content">
<a href="<?php the_permalink(); ?>" class="alignleft"><?php the_post_thumbnail('home-events-image'); ?></a>
<div class="alignleft info">
<?php the_excerpt(); ?>
</div>
<div class="alignleft price">
<p>Price: <?php echo "$" . tribe_get_cost(); ?></p>
</div>
</div>
</div>
</article>
<?php
}
?>
<?php
if($events == null) {
?>
<article>
<div id="event-post-none" class="alignleft">
<div class="aligncenter">
<p>There are no upcoming events. Please check back soon.</p>
</div>
</div>
</article>
<?php } ?>
</div>
<img src="<?php print IMAGES; ?>/upcoming_events-btm.png" title="Arctic playhouse shows" class="alignleft upcoming" />
</div>
<?php endwhile; endif; ?>
已序列化数据?在找到这个方便的工具之前,我在迁移安装时遇到了很多问题。
串行数据替换
如果您使用不同的URL创建了测试站点,那么很可能是最终的实时站点(除非您使用虚拟主机并在本地和远程IP地址之间交换),您可能会遇到一些数据未迁移到实时站点的问题。
这些数据可能包括WordPress小部件没有显示,某些插件或主题数据丢失。这些数据可能没有进行迁移的原因是,由于数据已在数据库中用旧URL序列化,因此数据丢失,然后由于存在新URL而无法取消序列化。
我能解释的最好的一点是,每个URL在SQL数据库中都有一个序列化的字符数——通常在迁移到不同的服务器时会发生变化。它打破了$hit。
我可以通过更改来修复它
'start_date' => strtotime($date->format('Y-m-d'))
至
'start_date' => strtotime(current_time('Y-m-d'))