|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /html/wordpress-old/wp-content/themes/Evolution/includes/widgets/ |
Upload File : |
<?php class CustomLogoWidget extends WP_Widget
{
function CustomLogoWidget(){
$widget_ops = array('description' => 'Displays Logo, Copyright and Additional Information');
$control_ops = array('width' => 400, 'height' => 300);
parent::WP_Widget(false,$name='ET Custom Logo Widget',$widget_ops,$control_ops);
}
/* Displays the Widget in the front-end */
function widget($args, $instance){
extract($args);
$logoImagePath = empty($instance['logoImagePath']) ? '' : $instance['logoImagePath'];
$textInfo = empty($instance['textInfo']) ? '' : $instance['textInfo'];
echo $before_widget;
?>
<p><img alt="" src="<?php echo esc_url($logoImagePath); ?>" /></p>
<?php echo $textInfo; ?>
<?php
echo $after_widget;
}
/*Saves the settings. */
function update($new_instance, $old_instance){
$instance = $old_instance;
$instance['logoImagePath'] = esc_url($new_instance['logoImagePath']);
$instance['textInfo'] = stripslashes($new_instance['textInfo']);
return $instance;
}
/*Creates the form for the widget in the back-end. */
function form($instance){
//Defaults
$instance = wp_parse_args( (array) $instance, array('logoImagePath'=>'', 'textInfo'=>'') );
$logoImagePath = $instance['logoImagePath'];
$textInfo = $instance['textInfo'];
# Logo Image
echo '<p><label for="' . $this->get_field_id('logoImagePath') . '">' . 'Logo Image URL:' . '</label><textarea cols="20" rows="2" class="widefat" id="' . $this->get_field_id('logoImagePath') . '" name="' . $this->get_field_name('logoImagePath') . '" >'. esc_url($logoImagePath) .'</textarea></p>';
# Text
echo '<p><label for="' . $this->get_field_id('textInfo') . '">' . 'Text:' . '</label><textarea cols="20" rows="5" class="widefat" id="' . $this->get_field_id('textInfo') . '" name="' . $this->get_field_name('textInfo') . '" >'. esc_textarea($textInfo) .'</textarea></p>';
}
}// end CustomLogoWidget class
function CustomLogoWidgetInit() {
register_widget('CustomLogoWidget');
}
add_action('widgets_init', 'CustomLogoWidgetInit');
?>