< class="entry-title"> > post_excerpt; $excerpt = null; if ($has_native_excerpt) { $excerpt = get_the_excerpt($post_id); } if (! $excerpt) { ob_start(); blocksy_trim_excerpt(get_the_excerpt($post_id), $length); $excerpt = ob_get_clean(); } ob_start(); ?>
screen->get_prefix(); $container_class = 'post-navigation'; $container_class .= ' ' . blocksy_visibility_classes(get_theme_mod( $prefix . '_post_nav_visibility', [ 'desktop' => 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($prefix . '_has_post_nav_thumb', 'yes') === 'yes'; if ($has_thumb) { $container_class .= ' has-thumbnails'; } $has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes'; $next_post_image_output = ''; $previous_post_image_output = ''; if ($next_post) { $next_title = ''; if ($has_title) { $next_title = $next_post->post_title; } if ($has_thumb) { $next_post_image_output = blocksy_image( [ 'attachment_id' => get_post_thumbnail_id( $next_post ), 'ratio' => '1/1', 'inner_content' => '', 'tag_name' => 'figure' ] ); } } 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', 'inner_content' => '', 'tag_name' => 'figure' ] ); } } ob_start(); ?> screen->get_prefix(); $per_page = intval(get_theme_mod($prefix . '_related_posts_count', 3)); $post_type = get_post_type($post); $terms = [ 'post' => [ 'categories' => 'category', 'tags' => 'post_tag', ], 'product' => [ 'categories' => 'product_cat', 'tags' => 'product_tag', ], ]; // categories | tags $criteria = get_theme_mod($prefix . '_related_criteria', 'categories'); $taxonomy = blocksy_akg($post_type . '/' . $criteria, $terms); if ($post_type !== 'product' && $post_type !== 'post') { $taxonomies = get_object_taxonomies($post_type); if (count($taxonomies) > 0) { $taxonomy = $taxonomies[0]; } else { $taxonomy = null; } } $all_taxonomy_ids = []; if ($taxonomy) { $all_taxonomies = get_the_terms($post->ID, $taxonomy); if ($all_taxonomies) { foreach ($all_taxonomies as $current_taxonomy) { $all_taxonomy_ids[] = $current_taxonomy->term_id; } } } $query = new WP_Query(array_merge([ 'ignore_sticky_posts' => 0, 'posts_per_page' => $per_page, 'post__not_in' => [ $post->ID ], 'post_type' => $post_type, ], ! empty($all_taxonomy_ids) ? [ 'tax_query' => [ [ 'field' => 'id', 'taxonomy' => $taxonomy, 'terms' => $all_taxonomy_ids, ] ] ] : [])); $label = get_theme_mod( $prefix . '_related_label', __( 'Related Posts', 'blocksy') ); $meta_elements = get_theme_mod( $prefix . '_related_single_meta_elements', blocksy_post_meta_defaults([ [ 'id' => 'post_date', 'enabled' => true, ], [ 'id' => 'comments', 'enabled' => true, ], ]) ); $columns = get_theme_mod($prefix . '_related_posts_columns', 3); $class = 'ct-related-posts-container'; if (! $query->have_posts()) { wp_reset_postdata(); return; } $label_tag = get_theme_mod($prefix . '_related_label_wrapper', 'h3'); $container_class = 'ct-container'; if (get_theme_mod($prefix . '_related_structure', 'normal') === 'narrow') { $container_class = 'ct-container-narrow'; } ?>