biletci adlı üyeden alıntı: mesajı görüntüle
Eklenti etkinleştirilemedi, çünkü önlenemeyen bir hataya sebep oldu.


Fatal error: Cannot redeclare byt_home_feature_widgets() (previously declared in /home/.../public_html/tur/wp-content/themes/..../plugins/widgets/widget-home-feature.php:15) in /home/.../public_html/tur/wp-content/plugins/widgets/widget-home-feature.php on line 16
Denermisin :

<?php
 
/*-----------------------------------------------------------------------------------
 
   Plugin Name: BYT Home Feature
 
-----------------------------------------------------------------------------------*/
 
 
// Add function to widgets_init that'll load our widget.
add_action( 'widgets_init', 'home_register_widgetsdo' );
 
// Register widget.
function home_register_widgetsdo() {
   register_widget( 'byt_Home_Feature_Widget' );
}
 
// Widget class.
class byt_Home_Feature_Widget extends WP_Widget {
 
 
/*-----------------------------------------------------------------------------------*/
/* Widget Setup
/*-----------------------------------------------------------------------------------*/
    
   function byt_Home_Feature_Widget() {
    
      /* Widget settings. */
      $widget_ops = array( 'classname' => 'byt_home_feature_widget', 'description' => __('BookYourTravel: Home Feature Widget', 'bookyourtravel') );
 
      /* Widget control settings. */
      $control_ops = array( 'width' => 300, 'height' => 550, 'id_base' => 'byt_home_feature_widget' );
 
      /* Create the widget. */
      $this->WP_Widget( 'byt_home_feature_widget', __('BookYourTravel: Home Feature Widget', 'bookyourtravel'), $widget_ops, $control_ops );
   }
 
 
/*-----------------------------------------------------------------------------------*/
/* Display Widget
/*-----------------------------------------------------------------------------------*/
    
   function widget( $args, $instance ) {
      extract( $args );
 
      /* Our variables from the widget settings. */
      $title = apply_filters('widget_title', $instance['title'] );
      $home_feature_text = $instance['home_feature_text'];
 
      /* Before widget (defined by themes). */
      echo $before_widget;
 
      /* Display Widget */
      ?>
         <article class="home_features clearfix">
            <h2><?php echo $title; ?></h2>
            <p><?php echo $home_feature_text; ?></p>
         </article>
      <?php
 
      /* After widget (defined by themes). */
      echo $after_widget;
   }
 
 
/*-----------------------------------------------------------------------------------*/
/* Update Widget
/*-----------------------------------------------------------------------------------*/
    
   function update( $new_instance, $old_instance ) {
      $instance = $old_instance;
 
      /* Strip tags to remove HTML (important for text inputs). */
      $instance['title'] = strip_tags( $new_instance['title'] );
      $instance['home_feature_text'] = strip_tags( $new_instance['home_feature_text']);
 
      return $instance;
   }
    
 
/*-----------------------------------------------------------------------------------*/
/* Widget Settings
/*-----------------------------------------------------------------------------------*/
     
   function form( $instance ) {
 
      /* Set up some default widget settings. */
      $defaults = array(
      'title' => 'Handpicked Accommodations',
      'home_feature_text' => 'All Book Your Travel Accommodations fulfil strict selection criteria. Each accommodation is chosen individually and inclusion cannot be bought.',
      );
      $instance = wp_parse_args( (array) $instance, $defaults ); ?>
 
      <!-- Widget Title: Text Input -->
      <p>
         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'bookyourtravel') ?></label>
         <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
      </p>
 
      <p>
         <label for="<?php echo $this->get_field_id( 'home_feature_text' ); ?>"><?php _e('Feature text:', 'bookyourtravel') ?></label>
         <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'home_feature_text' ); ?>" name="<?php echo $this->get_field_name( 'home_feature_text' ); ?>" value="<?php echo $instance['home_feature_text']; ?>" />
      </p>
       
   <?php
   }
}
?>