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') {
$default_style = 'boxed';
}
return $default_style;
}
}
/**
* Single post helpers
*
* @copyright 2019-present Creative Themes
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @package Blocksy
*/
add_filter('render_block', function ($block_content, $block) {
if (! isset($block['attrs']['align'])) {
return $block_content;
}
if (
$block['attrs']['align'] !== 'right'
&&
$block['attrs']['align'] !== 'left'
) {
return $block_content;
}
if (! isset($block['firstLevelBlock'])) {
return $block_content;
}
if (! $block['firstLevelBlock']) {
return $block_content;
}
$additional_class = '';
if (get_theme_mod('left_right_wide', 'yes') === 'yes') {
$additional_class = 'alignwide';
}
if (
strpos($block_content, 'alignleft') !== false
||
strpos($block_content, 'alignright') !== false
) {
$first_div = explode('>', $block_content)[0];
if (
strpos($first_div, 'alignleft') !== false
||
strpos($first_div, 'alignright') !== false
) {
$class = 'align-wrap-' . esc_attr(
$block['attrs']['align']
) . ' ' . $additional_class;
return sprintf(
'
%2$s
',
$class,
$block_content
);
} else {
return preg_replace(
'/(.*?)class="(.*?)"(.*)/',
'\1class="\2 align-wrap-' . esc_attr(
$block['attrs']['align']
) . ' ' . $additional_class . '"\3',
$block_content
);
}
}
return $block_content;
}, 10, 2);
/**
* User social channels
*
* @param string $tooltip Should output tooltips.
*/
if (! function_exists('blocksy_author_social_channels')) {
function blocksy_author_social_channels() {
$facebook = get_the_author_meta('facebook');
$linkedin = get_the_author_meta('linkedin');
$dribbble = get_the_author_meta('dribbble');
$website = get_the_author_meta('user_url');
$twitter = get_the_author_meta('twitter');
$instagram = get_the_author_meta('instagram');
$pinterest = get_the_author_meta('pinterest');
$wordpress = get_the_author_meta('wordpress');
$github = get_the_author_meta('github');
$medium = get_the_author_meta('medium');
$youtube = get_the_author_meta('youtube');
$vimeo = get_the_author_meta('vimeo');
$vkontakte = get_the_author_meta('vkontakte');
$odnoklassniki = get_the_author_meta('odnoklassniki');
$tiktok = get_the_author_meta('tiktok');
if (
! (
$website
||
$facebook
||
$twitter
||
$linkedin
||
$dribbble
||
$instagram
||
$pinterest
||
$wordpress
||
$github
||
$medium
||
$youtube
||
$vimeo
||
$vkontakte
||
$odnoklassniki
||
$tiktok
)
) {
return;
}
$class = 'author-box-social';
?>
[
'joined' => false,
'articles_count' => false,
'comments' => false
],
'attr' => []
]
);
if (
! $args['value']['joined']
&&
! $args['value']['articles_count']
&&
! $args['value']['comments']
) {
return;
}
$user_data = get_userdata(get_the_author_meta('ID'));
$joined_date = '';
if ($user_data && isset($user_data->user_registered)) {
$joined_date = date(
"F j, Y",
strtotime($user_data->user_registered)
);
}
$comments_count = get_comments([
'type' => '',
'user_id' => get_the_author_meta('ID'),
'count' => true,
]);
$posts_count = count_user_posts(get_the_author_meta('ID'));
$container_attr = array_merge([
'class' => 'entry-meta',
'data-type' => 'simple:slash'
], $args['attr']);
?>
screen->get_prefix();
$type = get_theme_mod($prefix . '_single_author_box_type', 'type-2');
$has_author_box_social = get_theme_mod(
$prefix . '_single_author_box_social',
'yes'
) === 'yes';
$has_author_box_posts_count = get_theme_mod(
$prefix . '_single_author_box_posts_count',
'yes'
) === 'yes';
$class = 'author-box';
$class .= ' ' . blocksy_visibility_classes(get_theme_mod(
$prefix . '_author_box_visibility',
[
'desktop' => true,
'tablet' => true,
'mobile' => false,
]
));
?>
120]),
[
'tag_name' => 'a',
'inner_content' => '
',
'html_atts' => [
'href' => get_author_posts_url(
get_the_author_meta('ID'),
get_the_author_meta('user_nicename')
)
],
'img_atts' => ['width' => 60, 'height' => 60],
]
);
?>
' . 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 '';
}
$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 blocksy_html_tag('figure', ['class' => $class], blocksy_image([
'attachment_id' => get_post_thumbnail_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'
)
]) . $maybe_figcaption);
}
}