class="entry-title">
>
true,
'tablet' => true,
'mobile' => true,
]));
$next_post = get_adjacent_post( false, '', true );
$previous_post = get_adjacent_post( false, '', false );
$home_page_url = get_home_url();
$post_slug = get_post_type() === 'post' ? __( 'Post', 'blocksy' ) : get_post_type_object( get_post_type() )->labels->singular_name;
$post_slug = ' ' . $post_slug . '';
$has_thumb = get_theme_mod(
'has_post_nav_thumb',
'yes'
) === 'yes' || $check_for_preview;
$has_title = get_theme_mod(
'has_post_nav_title',
'yes'
) === 'yes' || $check_for_preview;
if ( $next_post ) {
$next_title = '';
if ( $has_title ) {
$next_title = $next_post->post_title;
}
$next_post_image_output = '';
if ( $has_thumb ) {
$next_post_image_output = blocksy_image(
[
'attachment_id' => get_post_thumbnail_id( $next_post ),
'ratio' => '1/1',
]
);
}
}
if ( $previous_post ) {
$previous_title = '';
if ( $has_title ) {
$previous_title = $previous_post->post_title;
}
if ( $has_thumb ) {
$previous_post_image_output = blocksy_image(
[
'attachment_id' => get_post_thumbnail_id( $previous_post ),
'ratio' => '1/1',
]
);
}
}
ob_start();
?>
[
'categories' => 'category',
'tags' => 'post_tag',
],
'fw-portfolio' => [
'categories' => 'fw-portfolio-category',
'tags' => 'fw-portfolio-category',
],
'product' => [
'categories' => 'product_cat',
'tags' => 'product_tag',
],
];
// categories | tags
$criteria = get_theme_mod('related_criteria', 'categories');
$taxonomy = blocksy_akg( $post_type . '/' . $criteria, $terms );
$all_taxonomy_ids = [];
$all_taxonomies = get_the_terms($post->ID, $taxonomy);
if (! $all_taxonomies) {
return '';
}
foreach ($all_taxonomies as $current_taxonomy) {
$all_taxonomy_ids[] = $current_taxonomy->term_id;
}
$query = new WP_Query(
[
'ignore_sticky_posts' => 0,
'posts_per_page' => $per_page,
'post__not_in' => [ $post->ID ],
'post_type' => $post_type,
'tax_query' => [
[
'field' => 'id',
'taxonomy' => $taxonomy,
'terms' => $all_taxonomy_ids,
],
],
]
);
$label = get_theme_mod('related_label', __( 'Related Posts', 'blocksy' ));
$meta_elements = get_theme_mod(
'related_meta_elements',
[
'author' => false,
'date' => true,
'categories' => false,
'comments' => true,
]
);
if ($is_cache_phase) {
$meta_elements = [
'author' => true,
'date' => true,
'categories' => true,
'comments' => true,
];
}
$columns = get_theme_mod( 'related_posts_columns', 3 );
$class = 'ct-related-posts';
$class .= ' ' . blocksy_visibility_classes(get_theme_mod('related_visibility', [
'desktop' => true,
'tablet' => false,
'mobile' => false,
]));
if (! $query->have_posts()) {
wp_reset_postdata();
return;
}
?>
have_posts() ) { ?>
the_post(); ?>
- >
get_post_thumbnail_id(),
'ratio' => get_theme_mod(
'related_featured_image_ratio',
'16/9'
),
'tag_name' => 'a',
'size' => 'medium_large',
'html_atts' => [
'href' => esc_url( get_permalink() ),
],
]
));
?>
blocksy_akg(
'categories',
$meta_elements,
false
),
'author' => blocksy_akg(
'author',
$meta_elements,
false
),
// 'author_avatar' => blocksy_akg( 'has_author_avatar', $single_component, 'no' ) === 'yes',
'post_date' => blocksy_akg(
'date',
$meta_elements,
false
),
'comments' => blocksy_akg(
'comments',
$meta_elements,
false
),
],
[
'date_format_source' => get_theme_mod(
'related_date_format_source',
'default'
),
'date_format' => get_theme_mod(
'related_meta_date_format',
'M j, Y'
),
'labels' => $is_cache_phase || get_theme_mod(
'has_related_meta_label',
'yes'
) === 'yes',
]
);
?>