slug ); $list[ $slug ] = 'powerkit_social_links_counter'; return $list; } /** * Adds custom user contact methods * * @param array $user_contacts array of all user contacts. */ public function contactmethods( $user_contacts ) { return array_merge( $user_contacts, powerkit_get_author_fields() ); } /** * Social Links fields in Guest Author profiles * * @param array $fields Fields to be returned. * @param array $groups Field groups. */ public function guest_author_fields( $fields, $groups ) { if ( in_array( 'all', $groups, true ) || in_array( 'contact-info', $groups, true ) ) { foreach ( powerkit_get_author_fields() as $slug => $name ) { $fields[] = array( 'key' => $slug, 'label' => $name, 'group' => 'contact-info', ); } } return $fields; } /** * Register admin page * * @since 1.0.0 */ public function register_options_page() { add_options_page( esc_html__( 'Social Links', 'powerkit' ), esc_html__( 'Social Links', 'powerkit' ), 'manage_options', powerkit_get_page_slug( $this->slug ), array( $this, 'build_options_page' ) ); } /** * Build admin page * * @since 1.0.0 */ public function build_options_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have sufficient rights to view this page.', 'powerkit' ) ); } $this->save_options_page(); ?>
$field_caption ) { if ( isset( $_POST[ $field_key ] ) ) { // Input var ok. update_option( $field_key, sanitize_text_field( wp_unslash( $_POST[ $field_key ] ) ) ); // Input var ok. } } } } // Reset cache. Powerkit_Connect::reset_cache( 'powerkit_social_links_counter' ); printf( '%s