繁体   English   中英

WordPress活动日历PHP在Godaddy服务器上不起作用,但在WAMP本地主机中起作用

[英]WordPress Events Calendar PHP not working on Godaddy server, but works in WAMP localhost

这段代码可以在我的WAMP本地主机上运行,​​但不能在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数据库中都有一个序列化的字符数-通常在迁移到其他服务器时会发生变化。 它打破了$命中。

我可以通过更改来修复它

'start_date' => strtotime($date->format('Y-m-d'))

'start_date' => strtotime(current_time('Y-m-d'))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM