plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Archive_Akkordion_Loader as all of the hooks are defined
* in that particular class.
*
* The Archive_Akkordion_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/archive-akkordion-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Archive_Akkordion_Loader as all of the hooks are defined
* in that particular class.
*
* The Archive_Akkordion_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/archive-akkordion-admin.js', array( 'jquery' ), $this->version, false );
}
/**
* Register the new archive widget
*
* @since 1.0.0
*/
public function register_archive_widget() {
register_widget( 'IL_Archive_Akkordion' );
}
}
class IL_Archive_Akkordion extends WP_Widget {
/**
* Extends WordPress Native Widget Class
*
* @since 1.0.0
*/
public function IL_Archive_Akkordion() {
$widget_ops = array(
'classname' => 'widget-archive-akkordion',
'description' => __('A widget to display a custom archive in a widget section with an accordion layout.', 'archive-akkordion')
);
// Instantiate the parent object
parent::__construct( 'widget-archive-akkordion', __( 'Archive akkordion', 'archive-akkordion' ), $widget_ops );
}
/**
* Output the widget
*
* @since 1.0.0
* @param array $args takes arguments from widget form
* @param array $instance gets current setting values
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters(
'widget_title', empty($instance[ 'title' ] ) ? __( 'Archives', 'archive-akkordion' ) : $instance[ 'title' ], $instance, $this->id_base
);
$animation = ( empty($instance[ 'animation' ] )) ? '250' : $instance[ 'animation' ];
$structure = $before_widget;
if ( $title ) $structure .= $before_title . $title . $after_title;
$structure .= "