96, // User ID | WP_Comment | WP_Post 'avatar_entity' => '__default__' ]); if ($args['avatar_entity'] === '__default__') { $args['avatar_entity'] = blocksy_get_author_id(); } // user registration plugin if (function_exists('ur_replace_gravatar_image')) { $user_id = $args['avatar_entity']; if ($args['avatar_entity'] instanceof WP_Comment) { $user_id = $args['avatar_entity']->user_id; } $avatar_id = get_user_meta( $user_id, 'user_registration_profile_pic_url', true ); if ($avatar_id) { return wp_get_attachment_url($avatar_id); } } return get_avatar_url( $args['avatar_entity'], [ 'size' => $args['size'] ] ); } if (! function_exists('blocksy_get_author_id')) { function blocksy_get_author_id() { $author_id = get_queried_object_id(); if (is_singular()) { $author_id = get_the_author_meta('ID'); } if (! $author_id) { $author = get_user_by('slug', get_query_var('author_name')); $author_id = $author->ID; } return $author_id; } } function blocksy_get_the_author_meta($field, $user_id = false) { if (! $user_id) { $user_id = blocksy_get_author_id(); } $maybe_meta = apply_filters( 'blocksy:author:get_the_author_meta', null, $field, $user_id ); if ($maybe_meta !== null) { return $maybe_meta; } return get_the_author_meta($field, $user_id); } function blocksy_count_user_posts() { $author_id = blocksy_get_author_id(); $maybe_count = apply_filters('blocksy:author:count_user_posts', null, $author_id); if ($maybe_count !== null) { return $maybe_count; } if (! get_userdata($author_id)) { return 0; } return count_user_posts( $author_id, array_merge( ['post'], blocksy_manager()->post_types->get_supported_post_types() ) ); } if (! function_exists('blocksy_post_uses_vc')) { function blocksy_post_uses_vc() { $post = get_post(); return $post && preg_match('/vc_row/', $post->post_content); } } if (! function_exists('blocksy_get_content_style_default')) { function blocksy_get_content_style_default($prefix = null) { if (! $prefix) { $prefix = blocksy_manager()->screen->get_prefix(); } $default_style = 'wide'; if ( $prefix === 'bbpress_single' || ( $prefix === 'courses_single' && function_exists('tutor') ) ) { $default_style = 'boxed'; } return $default_style; } } /** * User social channels * * @param string $tooltip Should output tooltips. */ if (! function_exists('blocksy_author_social_channels')) { function blocksy_author_social_channels($args = []) { $args = wp_parse_args( $args, [ 'new_tab' => true ] ); $meta_ids = [ 'facebook', 'linkedin', 'dribbble', 'user_url', 'twitter', 'instagram', 'pinterest', 'wordpress', 'github', 'medium', 'youtube', 'vimeo', 'vkontakte', 'odnoklassniki', 'tiktok', 'mastodon' ]; $outputs = []; $descriptor = [ 'facebook' => [ 'label' => 'Facebook icon', 'icon' => '' ], 'linkedin' => [ 'label' => 'LinkedIn icon', 'icon' => '' ], 'dribbble' => [ 'label' => 'Dribbble icon', 'icon' => '' ], 'user_url' => [ 'label' => 'Website icon', 'icon' => '' ], 'twitter' => [ 'label' => 'X (Twitter) icon', 'icon' => '' ], 'instagram' => [ 'label' => 'Instagram icon', 'icon' => '' ], 'pinterest' => [ 'label' => 'Pinterest icon', 'icon' => '' ], 'wordpress' => [ 'label' => 'WordPress icon', 'icon' => '' ], 'github' => [ 'label' => 'GitHub icon', 'icon' => '' ], 'medium' => [ 'label' => 'Medium icon', 'icon' => '' ], 'youtube' => [ 'label' => 'YouTube icon', 'icon' => '' ], 'vimeo' => [ 'label' => 'Vimeo icon', 'icon' => '' ], 'vkontakte' => [ 'label' => 'Vkontakte icon', 'icon' => '' ], 'odnoklassniki' => [ 'label' => 'Odnoklassniki icon', 'icon' => '' ], 'tiktok' => [ 'label' => 'TikTok icon', 'icon' => '' ], 'mastodon' => [ 'label' => 'Mastodon icon', 'icon' => '' ] ]; $additional_descriptors = apply_filters( 'blocksy:author-profile:custom-social-network', [] ); foreach ($additional_descriptors as $field) { if ( isset($field['id']) && isset($field['name']) && isset($field['icon']) ) { $descriptor[$field['id']] = [ 'label' => $field['name'], 'icon' => $field['icon'] ]; $meta_ids[] = $field['id']; } } foreach ($meta_ids as $network_id) { $meta_value = get_the_author_meta($network_id); if (! $meta_value) { continue; } $attr = [ 'href' => esc_url($meta_value), 'aria-label' => $descriptor[$network_id]['label'] ]; $attr['rel'] = 'noopener'; if ($args['new_tab']) { $attr['rel'] = 'noopener noreferrer nofollow'; $attr['target'] = '_blank'; } $outputs[] = blocksy_html_tag( 'a', $attr, $descriptor[$network_id]['icon'] ); } if (empty($outputs)) { return; } echo blocksy_html_tag( 'div', [ 'class' => 'author-box-socials' ], blocksy_html_tag( 'span', [], implode(' ', $outputs) ) ); } } if (! function_exists('blocksy_author_meta_elements')) { function blocksy_author_meta_elements($args = []) { if (! is_author()) { return; } $args = wp_parse_args( $args, [ 'value' => [ 'joined' => false, 'articles_count' => false, 'comments' => false ], 'attr' => [] ] ); if ( ! $args['value']['joined'] && ! $args['value']['articles_count'] && ! $args['value']['comments'] ) { return; } $user_data = get_userdata(blocksy_get_author_id()); $joined_date = ''; if ($user_data && isset($user_data->user_registered)) { $joined_date = date_i18n( get_option('date_format', ''), strtotime($user_data->user_registered) ); } $comments_count = get_comments([ 'type' => '', 'user_id' => blocksy_get_author_id(), 'count' => true, ]); $posts_count = 0; $posts_count = blocksy_count_user_posts(); $container_attr = array_merge([ 'class' => 'entry-meta', 'data-type' => 'simple:slash' ], $args['attr']); ?> screen->get_prefix(); $type = blocksy_get_theme_mod($prefix . '_single_author_box_type', 'type-2'); $wrapper_tag = blocksy_get_theme_mod($prefix . '_single_author_box_name_heading', 'h5'); $has_author_box_social = blocksy_get_theme_mod( $prefix . '_single_author_box_social', 'yes' ) === 'yes'; $has_author_box_posts_count = blocksy_get_theme_mod( $prefix . '_single_author_box_posts_count', 'yes' ) === 'yes'; $class = 'author-box'; $class .= ' ' . blocksy_visibility_classes(blocksy_get_theme_mod( $prefix . '_author_box_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ] )); $deep_link_args = [ 'prefix' => $prefix, 'suffix' => $prefix . '_has_author_box', 'shortcut' => 'border' ]; $with_link = blocksy_get_theme_mod($prefix . '_single_author_box_archive_link', 'yes') === 'yes'; ?>
> 120 ] ) ), [ 'tag_name' => $with_link ? 'a' : 'span', 'inner_content' => $with_link ? ' ' : '', 'html_atts' => array_merge( $with_link ? [ 'href' => get_author_posts_url( blocksy_get_author_id(), blocksy_get_the_author_meta('user_nicename') ), ] : [], [] ), 'img_atts' => [ 'width' => 60, 'height' => 60, 'alt' => blocksy_get_avatar_alt_for(get_the_author_meta('ID')) ], ] ); ?>
< class="author-box-name"> >
blocksy_get_theme_mod( $prefix . '_single_author_box_social_link_target', 'no' ) === 'yes' ]); } ?> post_types->get_supported_post_types() ) ); echo blocksy_html_tag( $with_link ? 'a' : 'span', array_merge( $with_link ? [ 'href' => get_author_posts_url(blocksy_get_author_id()), ] : [], [ 'class' => 'ct-author-box-more' ] ), esc_html(__('Articles', 'blocksy')) . ': ' . $posts_count ); } ?>
post_types->is_supported_post_type(); if ($post_type) { return [ 'prefix' => $post_type . '_single', 'strategy' => 'customizer' ]; } if (blocksy_is_page()) { return [ 'strategy' => 'customizer', 'prefix' => 'single_page' ]; } return [ 'strategy' => 'customizer', 'prefix' => 'single_blog_post' ]; } } if (! function_exists('blocksy_get_featured_image_output')) { function blocksy_get_featured_image_output() { $featured_image_source = blocksy_get_featured_image_source(); if (blocksy_akg_or_customizer( 'has_featured_image', $featured_image_source, 'no' ) === 'no') { return ''; } if (blocksy_default_akg( 'disable_featured_image', blocksy_get_post_options(), 'no' ) === 'yes') { return ''; } if (! has_post_thumbnail()) { return ''; } $prefix = blocksy_manager()->screen->get_prefix(); $has_video_thumbnail = blocksy_akg_or_customizer( 'video_thumbnail', $featured_image_source, 'no' ); $class = 'ct-featured-image'; $class .= ' ' . blocksy_visibility_classes( blocksy_akg_or_customizer( 'featured_image_visibility', $featured_image_source, [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ] ) ); if (blocksy_sidebar_position() === 'none') { $image_width = blocksy_akg_or_customizer( 'featured_image_width', $featured_image_source, 'default' ); if ($image_width === 'wide') { $class .= ' alignwide'; } if ($image_width === 'full') { $class .= ' alignfull'; } } $maybe_figcaption = wp_get_attachment_caption(get_post_thumbnail_id()); if (! empty($maybe_figcaption)) { $maybe_figcaption = '
' . trim($maybe_figcaption) . '
'; } else { $maybe_figcaption = ''; } return apply_filters( 'post_thumbnail_html', blocksy_html_tag('figure', ['class' => $class], blocksy_media([ 'attachment_id' => get_post_thumbnail_id(), 'post_id' => get_the_ID(), 'ratio' => blocksy_akg_or_customizer( 'featured_image_ratio', $featured_image_source, 'original' ), 'size' => blocksy_akg_or_customizer( 'featured_image_size', $featured_image_source, 'full' ), 'display_video' => $has_video_thumbnail === 'yes', 'lazyload' => blocksy_get_theme_mod( 'has_lazy_load_single_featured_image', 'yes' ) === 'yes' ]) . $maybe_figcaption), get_the_ID(), get_post_thumbnail_id(), blocksy_akg_or_customizer( 'featured_image_size', $featured_image_source, 'full' ), '' ); } }