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 .= "'; $structure .= $after_widget; echo $structure; } /** * Updating/saving changes for the widget * * @since 1.0.0 * @param array $old_instance Initial settings * @param array $new_instance updated Settings */ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $new_instance = wp_parse_args( ( array ) $new_instance, array( 'title' => '', 'animation' => '250', 'counter' => false ) ); $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ]); $instance[ 'animation' ] = strip_tags( $new_instance[ 'animation' ] ); $instance[ 'counter' ] = strip_tags( $new_instance[ 'counter' ] ); return $instance; } /** * Output admin widget options form * * @since 1.0.0 * @param array $instance Initial settings */ public function form( $instance ) { $instance = wp_parse_args( ( array ) $instance, array( 'title' => '', 'animation' => '250', 'counter' => false ) ); $title = strip_tags( $instance[ 'title' ]) ; $animation = strip_tags( $instance[ 'animation' ] ); ?>

id="get_field_id( 'counter' ); ?>" name="get_field_name( 'counter' ); ?>" type="checkbox" value="1" />