简体   繁体   English

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

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

This code works on my WAMP localhost, but not on the Godaddy server, I checked the php versions and they are the same, been having a tough time trying to figure out what the issue is. 这段代码可以在我的WAMP本地主机上运行,​​但不能在Godaddy服务器上运行,我检查了php版本,它们是相同的,一直很难找出问题所在。 Any one have suggestions? 有人有建议吗? Thank You 谢谢

website: http://www.thearcticplayhouse.com 网址: 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; ?>

Seralized data? 序列化数据? I've had so many problems migrating installations until I found this handy tool. 在找到这个方便的工具之前,我在迁移安装时遇到了很多问题。

Serialized Data Replacement 序列化数据替换

If you have created your test site with a different URL then the finishing live site which is more than likely, (unless you are using Virtual Hosts and are swapping between local and remote IP addresses) you may run into issues with some data not being migrated to the live site. 如果您使用不同的URL创建了测试站点,则创建的实时站点很有可能(除非您正在使用虚拟主机并且正在本地和远程IP地址之间进行交换),否则可能会遇到一些数据无法迁移的问题到现场。

This data may include WordPress widgets not showing, certain plugins or theme data is missing. 此数据可能包括未显示的WordPress小部件,缺少某些插件或主题数据。 The reason this data may not have made the migration trip is because it is lost as the data has been serialized in the database with the old URL and then can't be unserialized as there is a new URL. 该数据之所以没有进行迁移,是因为它已丢失,因为该数据已使用旧的URL在数据库中进行了序列化,然后由于存在新的URL而无法反序列化。

The best I can explain is that every URL has a serialized character count in the SQL database - that changes upon migrating to different server, usually. 我能解释的最好的一点是,每个URL在SQL数据库中都有一个序列化的字符数-通常在迁移到其他服务器时会发生变化。 It breaks $hit. 它打破了$命中。

I was able to fix it by changing 我可以通过更改来修复它

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

to

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

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

相关问题 PHP图片上传可在localhost上运行,但不能在GoDaddy服务器上运行 - PHP picture upload works on localhost but not on GoDaddy server 填充php数组变量不适用于godaddy服务器(php版本5.3.24)在localhost中完美运行 - populating php array variable is not working in godaddy server(php version 5.3.24) works perfectly in localhost php function 验证令牌在 localhost 中有效,但在 GoDaddy 服务器上无效 - php function verify token works in localhost but not on GoDaddy server Php脚本不能在Wamp Localhost上工作,但在远程服务器上工作正常 - Php Script not working on Wamp Localhost but working fine on remote server 带Wamp服务器的Wordpress上的PHP - PHP on Wordpress with Wamp server 语法在localhost上运行,而不在godaddy服务器上运行 - Syntax working on localhost, not working on godaddy server PHP重定向或cookie,不适用于Godaddy,但适用于localhost - PHP Redirects, or cookies, not working on Godaddy, but working on localhost Wamp Server 3.0.6可以正常工作,但不能在网络上运行 - Wamp Server 3.0.6 working fine as localhost, but not on network 使用Wordpress的PHP文件下载可在localhost上运行,但不能在实时服务器上运行 - PHP file download with Wordpress works on localhost but not live server php_memcache无法在我的本地主机上运行 - php_memcache not working on my localhost wamp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM