ID, 'ansico_avatar_url', true ); ?>

Ansico Avatar

Upload a custom profile picture. This will override Gravatar. If empty, Gravatar or standard logo will be used.

user_id ) ) { $user_id = $id_or_email->user_id; } elseif ( is_string( $id_or_email ) ) { $user = get_user_by( 'email', $id_or_email ); if ( $user ) { $user_id = $user->ID; } } if ( $user_id ) { $custom_avatar = get_user_meta( $user_id, 'ansico_avatar_url', true ); if ( ! empty( $custom_avatar ) ) { return $custom_avatar; } } return $url; } add_action( 'init', 'ansico_some_register_blocks' ); function ansico_some_register_blocks() { wp_register_script( 'ansico-some-blocks-script', plugins_url( 'block.js', __FILE__ ), array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-data', 'wp-components' ), '1.0.0' ); wp_register_style( 'ansico-some-blocks-style', plugins_url( 'style.css', __FILE__ ), array(), '1.0.0' ); register_block_type( 'ansico/some-author', array( 'editor_script' => 'ansico-some-blocks-script', 'editor_style' => 'ansico-some-blocks-style', 'style' => 'ansico-some-blocks-style', 'render_callback' => 'ansico_some_render_author_block' ) ); register_block_type( 'ansico/some-comment', array( 'editor_script' => 'ansico-some-blocks-script', 'editor_style' => 'ansico-some-blocks-style', 'style' => 'ansico-some-blocks-style', 'render_callback' => 'ansico_some_render_comment_block' ) ); } function ansico_some_render_author_block( $attributes, $content, $block ) { $post_id = get_the_ID(); $author_id = get_post_field( 'post_author', $post_id ) ?: get_current_user_id(); $name = get_the_author_meta( 'display_name', $author_id ); $bio = get_the_author_meta( 'description', $author_id ); $avatar_url = get_avatar_url( $author_id, array( 'size' => 100 ) ); ob_start(); ?>
'ansico-compact-author' ) ); ?>>
Avatar

50 ) ); $domain = ''; if ( ! empty( $url ) ) { $domain = parse_url( $url, PHP_URL_HOST ); $domain = str_replace( 'www.', '', $domain ); } $time_display = $time; if ( ! empty( $time ) ) { $timestamp = strtotime( $time ); if ( $timestamp ) { $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); $formatted_time = wp_date( $time_format, $timestamp ); $formatted_date = wp_date( $date_format, $timestamp ); $time_display = $formatted_time . ' · ' . $formatted_date; } } $source_label = __( 'Source:', 'ansico-some-plugin' ); if ( $source_label === 'Source:' ) { $locale = get_locale(); if ( strpos( $locale, 'da' ) === 0 ) { $source_label = 'Kilde:'; } elseif ( strpos( $locale, 'sv' ) === 0 ) { $source_label = 'Källa:'; } elseif ( strpos( $locale, 'no' ) === 0 || strpos( $locale, 'nb' ) === 0 || strpos( $locale, 'nn' ) === 0 ) { $source_label = 'Kilde:'; } elseif ( strpos( $locale, 'de' ) === 0 ) { $source_label = 'Quelle:'; } } ob_start(); ?>
'ansico-some-tweet' ) ); ?>> Avatar