AnsPress_Leaderboard_Widget::form( array $instance )
Description #
Widget form.
Parameters #
- $instancearray (Required) Instance of widget.
Source #
File: widgets/leaderboard.php
public function form( $instance ) { if ( isset( $instance['title'] ) ) { $title = $instance['title']; } else { $title = __( 'AnsPress Leader board', 'anspress-question-answer' ); } $avatar_size = ! empty( $instance['avatar_size'] ) ? absint( $instance['avatar_size'] ) : 40; $show_users = ! empty( $instance['show_users'] ) ? absint( $instance['show_users'] ) : 12; $users_per_row = ! empty( $instance['users_per_row'] ) ? absint( $instance['users_per_row'] ) : 4; $interval = ! empty( $instance['interval'] ) ? absint( $instance['interval'] ) : 30; ?> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'anspress-question-answer' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'interval' ) ); ?>"><?php esc_attr_e( 'Interval (in days):', 'anspress-question-answer' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'interval' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'interval' ) ); ?>" type="number" value="<?php echo esc_attr( $interval ); ?>"> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'avatar_size' ) ); ?>"><?php esc_attr_e( 'Avatar size:', 'anspress-question-answer' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'avatar_size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'avatar_size' ) ); ?>" type="number" value="<?php echo esc_attr( $avatar_size ); ?>"> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'show_users' ) ); ?>"><?php esc_attr_e( 'Show users:', 'anspress-question-answer' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_users' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_users' ) ); ?>" type="number" value="<?php echo esc_attr( $show_users ); ?>"> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'users_per_row' ) ); ?>"><?php esc_attr_e( 'Users per row:', 'anspress-question-answer' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'users_per_row' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'users_per_row' ) ); ?>" type="number" value="<?php echo esc_attr( $users_per_row ); ?>"> </p> <?php return 'noform'; }
Expand full source code Collapse full source code View on GitHub: widgets/leaderboard.php:136
Add your comment