A custom plugin developed to add colors and styles matching the legacy styles of a website produced in the 90’s. Retro!! Love it.
<!--?php /* Plugin Name: Celtein Text Widget
Plugin URI: https://steelbridge.io/celtein-text-widget/
Description: Celtein Text Widget adds a custom text widget to the Celtein Theme that allows for a custom styled text area
Version: 1..0.0
Author: Chris Parsons Author
URI: https://steelbridge.io License: GPL v3
*/
// If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } define( 'CELTEIN_TEXT_WIDGET_VERSION', '1.0.0' ); class CelteinText_Widget extends WP_Widget { public function __construct() { parent::__construct( 'celteintext_widget', __( 'Celtein Text Widget', 'celteintextdomain' ), array( 'classname' => 'celteintext_widget',<br ?--> 'description' => __( 'A basic text widget developed for the Celtein theme.', 'celteintextdomain' )
)
);
load_plugin_textdomain( 'celteintextdomain', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
$message = $instance['message'];
echo $before_widget . '
<div class="card-class">
';
if ( $title ) {
echo $before_title . $title . $after_title;
}
echo '
<div class="textwidget">' . $message . '</div>
' . '
</div>
';
echo $after_widget;
}
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['message'] = ( $new_instance['message'] );
return $instance;
}
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form( $instance ) {
$title = esc_attr( $instance['title']);
$message = esc_attr($instance['message']); ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><!--?php _e('Title:'); ?--></label>
<label for="<?php echo $this->get_field_id('message'); ?>"><!--?php _e('Text &amp; HTML'); ?--></label>
<textarea id="<?php echo $this->get_field_id('message'); ?>" class="widefat" cols="20" name="<?php echo $this->get_field_name('message'); ?>" rows="16"><?php echo $message; ?></textarea>
<!--?php <br ?--> }
}
/* Register the widget */
add_action( 'widgets_init', function(){
register_widget( 'CelteinText_Widget' );
});
Plugin URI: https://steelbridge.io/celtein-text-widget/
Description: Celtein Text Widget adds a custom text widget to the Celtein Theme that allows for a custom styled text area
Version: 1..0.0
Author: Chris Parsons Author
URI: https://steelbridge.io License: GPL v3
*/
// If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } define( 'CELTEIN_TEXT_WIDGET_VERSION', '1.0.0' ); class CelteinText_Widget extends WP_Widget { public function __construct() { parent::__construct( 'celteintext_widget', __( 'Celtein Text Widget', 'celteintextdomain' ), array( 'classname' => 'celteintext_widget',<br ?--> 'description' => __( 'A basic text widget developed for the Celtein theme.', 'celteintextdomain' )
)
);
load_plugin_textdomain( 'celteintextdomain', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
$message = $instance['message'];
echo $before_widget . '
<div class="card-class">
';
if ( $title ) {
echo $before_title . $title . $after_title;
}
echo '
<div class="textwidget">' . $message . '</div>
' . '
</div>
';
echo $after_widget;
}
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['message'] = ( $new_instance['message'] );
return $instance;
}
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form( $instance ) {
$title = esc_attr( $instance['title']);
$message = esc_attr($instance['message']); ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><!--?php _e('Title:'); ?--></label>
<label for="<?php echo $this->get_field_id('message'); ?>"><!--?php _e('Text &amp; HTML'); ?--></label>
<textarea id="<?php echo $this->get_field_id('message'); ?>" class="widefat" cols="20" name="<?php echo $this->get_field_name('message'); ?>" rows="16"><?php echo $message; ?></textarea>
<!--?php <br ?--> }
}
/* Register the widget */
add_action( 'widgets_init', function(){
register_widget( 'CelteinText_Widget' );
});