WordPress小部件冲突

时间:2012-09-26 07:50:44

标签: php wordpress plugins

我有一个WordPress网站即将推出,主题开发人员不再响应。购买主题的几个用户也有同样的问题。

日历倒计时插件与主题设计相冲突。

这是小部件PHP代码(仅限事件日历部分):

<?php if ( ! defined('ABSPATH')) exit('restricted access');

//Feedburner_Widget Class

class FW_Eventcounter extends WP_Widget

{

    /** constructor */

    function __construct()

    {

        parent::__construct( /* Base ID */'eventcounter', /* Name */'Event Countdown', array( 'description' => 'Countdown the upcoming event' ) );

    }



    /** @see WP_Widget::widget */

    function widget($args, $instance)

    {

        global $_reserved_categories;



        $event_data = new wp_Query('showposts=4&meta_key=fw_event_time&meta_value='.time().'&meta_compare=>&order=asc&orderby=meta_value&post_type=events&post_status=publish');

        if( ! $event_data->found_posts) return;

        extract($args);

        $title = apply_filters( 'widget_title', $instance['title'] );

        echo $before_widget;



        $first = true;

        $recent_events = '';

        ?>



        <div class="events">

        <?php

        if($event_data->have_posts())

        while($event_data->have_posts()): $event_data->the_post();



        $eventDATA = get_post_meta(get_the_ID(), 'fw_events', true);

        $event_time = @get_time_difference(time(), $eventDATA['event_time']);

        $estartTime = @date('h:ia', $eventDATA['event_time']);

        $endTime = @date('h:ia', $eventDATA['event_time1']);



        foreach((array)$event_time as $k=>$v)

        {

            if(strlen($v) < 2) $event_time[$k] = (int) '0'.$event_time[$k];

        }



        $startTime = @implode(':', $event_time);



        if($first):

            $first = false;

            $title = ($startTime) ?  $title : 'Next Events';

            echo $before_title . $title . $after_title;?>

            <?php if($startTime): ?>

            <script type="text/javascript">

                $(function () {

                    var austDay = new Date(<?php echo date('Y',$eventDATA['event_time']);?>, <?php echo date('m',$eventDATA['event_time']);?> - 1, <?php echo date('d',$eventDATA['event_time']);?>);

                    $('#defaultCountdown').countdown({until: austDay});

                });

            </script>

                <div class="countersec">

                    <div class="counters">

                        <div id="defaultCountdown"></div>

                    </div>

                    <div class="upcomingevent backcolr">

                        <h6><a href="<?php the_permalink();?>" title="<?php the_title();?>" class="white"><?php the_title();?></a></h6>

                        <p><?php echo date('m/d/Y - h:i a', $eventDATA['event_time']);?>, <?php _e('Location:','heavens_corner');?> <?php echo $eventDATA['event_place'];?></p>

                    </div>

                </div>

            <?php endif;?>

        <?php else:

            $recent_events .= '<li>

                                <div class="datesec">

                                    <span class="date">'.date_i18n( 'd', $eventDATA['event_time'] ).'</span>

                                    <span class="month">'.date_i18n( 'M', $eventDATA['event_time'] ).'</span>

                                </div>

                                <div class="desc">

                                    <a href="'.get_permalink().'" class="txthover bold">'.get_the_title().'</a>

                                    <p>'.$estartTime.', '.__('Location:','heavens_corner').' '.$eventDATA['event_place'].'</p>

                                </div>

                            </li>';

        endif;?>

    <?php endwhile;?>

        <?php if($recent_events):?>

            <h3 class="colr bold widgethead"><?php _e('News and Events','heavens_corner');?></h3>

                <!-- Events Listing Start -->

                <ul><?php echo $recent_events;?></ul>

                <!-- Events Listing End -->

                <?php $terms = wp_get_post_terms(get_the_ID(), 'locations');?>

                <a href="<?php echo get_term_link((int)$terms[0]->term_id,'locations');?>" class="buttonone backcolr"><?php _e('View All','heavens_corner');?></a>

        <?php endif;?>

    </div>

    <?php

        echo $after_widget;

    }



    /** @see WP_Widget::update */

    function update($new_instance, $old_instance)

    {

        $instance = $old_instance;

        $instance['title'] = strip_tags($new_instance['title']);

        return $instance;

    }



    /** @see WP_Widget::form */

    function form($instance)

    {

        $title = ($instance) ? esc_attr($instance['title']) : 'Upcoming Event';

    ?>

        <p>

            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'heavens_corner'); ?></label> 

            <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />

        </p>

    <?php 

    }



} // class event counter

这是演示网站www.mbbcintl.com/wp/有问题的主页面(mbbcintl.com)目前已禁用查看,但主题来自mbbcintl.com/wp/网站,工作正常我没有做任何修改只是复制和粘贴主题。

由于

0 个答案:

没有答案