', $after = '', $echo = true ) { if ( ! is_user_logged_in() ) { if ( get_option( 'users_can_register' ) ) { $link = $before . '' . __( 'Register' ) . '' . $after; } else { $link = ''; } } else { $link = ''; } /** * Filters the HTML link to the Registration or Admin page. * * Users are sent to the admin page if logged-in, or the registration page * if enabled and logged-out. * * @since 1.5.0 * * @param string $link The HTML code for the link to the Registration or Admin page. */ $link = apply_filters( 'register', $link ); if ( $echo ) { echo $link; } else { return $link; } } // Creating the widget class agg_widget_meta extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'wagg_widget_meta', 'description' => __( 'Register, Login, Logout', 'agg-advanced-settings' ), 'customize_selective_refresh' => true, ); parent::__construct( // Base ID of your widget 'agg_widget_meta', // Widget name will appear in UI __('Aggregator Login', 'agg-advanced-settings'), $widget_ops ); } // Creating widget front-end public function widget( $args, $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Aggregator Meta' ); /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); /**@since 1.1.1 */ $privacy = ! empty( $instance['privacy'] ) ? '1' : '0'; /** before and after widget arguments are defined by themes */ echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } ?>
'', 'privacy' => 0, ) ); if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; } else { $title = __( 'New title', 'agg-advanced-settings' ); } // Widget admin form ?>
id="get_field_id( 'privacy' ); ?>" name="get_field_name( 'privacy' ); ?>" />
'', 'privacy' => 0, ) ); $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['privacy'] = $new_instance['privacy'] ? 1 : 0; return $instance; } } // Class agg_widget_meta ends here