) { /** * Displays the author box on the single post. */ function tripp_single_post_author() { if ( true !== tripp_post_can_show( 'metadata' ) ) { return; } $author_id = get_the_author_meta( 'ID' ); $args = array( 'author' => $author_id, 'display_name' => get_the_author_meta( 'display_name', $author_id ), 'posts_url' => get_author_posts_url( $author_id ), 'edit_link' => '', ); if ( current_user_can( 'edit_users' ) || get_current_user_id() === $author_id ) { $args['edit_link'] = admin_url( 'profile.php?user_id=' . $author_id ); } /** * Filters the arguments for the single post author template. * * @param array $args Parsed arguments. */ $args = apply_filters( 'tripp_single_post_author_args', $args ); get_template_part( 'template-parts/single/author', get_post_type(), $args ); } } if ( ! function_exists( 'tripp_single_post_breadcrumb' ) ) { /** * Displays the breadcrumb navigation on the single post. */ function tripp_single_post_breadcrumb() { $type = tripp_get_theme_setting( 'post_breadcrumb', '' ); if ( ! empty( $type ) ) { tripp_breadcrumb( array( 'taxonomy' => $type ) ); } elseif ( is_customize_preview() ) { echo '
'; } } } if ( ! function_exists( 'tripp_post_navigation' ) ) { /** * Displays the post navigation. */ function tripp_post_navigation() { if ( tripp_get_theme_setting( 'post_navigation', true ) || is_customize_preview() ) { $prev_post = get_previous_post(); $next_post = get_next_post(); if ( empty( $prev_post ) && empty( $next_post ) ) { return; } $post_type = get_post_type_object( get_post_type() ); $args = array( 'archive_link' => '', 'archive_text' => '', 'prev_post' => $prev_post, 'next_post' => $next_post, 'post_type' => $post_type->labels->singular_name, ); $archive_link = get_post_type_archive_link( $post_type->name ); if ( false !== $archive_link ) { $args['archive_link'] = $archive_link; $args['archive_text'] = $post_type->labels->all_items; } get_template_part( 'template-parts/single/navigation', $post_type->name, $args ); } } } if ( ! function_exists( 'tripp_post_navigation_thumbnail' ) ) { /** * Displays the post thumbnail in the post navigation. * * @param int|WP_Post $post Post ID or WP_Post object. */ function tripp_post_navigation_thumbnail( $post ) { $thumbnail = get_the_post_thumbnail( $post, 'thumbnail' ); if ( ! empty( $thumbnail ) ) { echo ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } if ( ! function_exists( 'tripp_related_posts_carousel' ) ) { /** * Renders the Related Posts carousel. * * @param array $attributes The attributes list for the block. */ function tripp_related_posts_carousel( $attributes = array() ) { if ( function_exists( 'flextension_block_post_carousel_render' ) ) { $attributes = wp_parse_args( array( 'title' => esc_html__( 'You might also like', 'tripp' ), 'className' => 'related-posts', 'columns' => 3, 'navigation' => true, 'query' => array( 'numberOfItems' => 10, ), 'query_vars' => array(), 'taxonomies' => array( 'post_tag' ), 'displayDate' => false, 'displayAuthor' => false, 'displayButtons' => false, ), $attributes ); $post_type = get_query_var( 'post_type' ); if ( empty( $post_type ) ) { $post_type = get_post_type(); } $query_vars = wp_parse_args( array( 'post_type' => $post_type, 'post__not_in' => array( get_the_ID() ), 'post_status' => 'publish', 'tax_query' => array(), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query ), $attributes['query_vars'] ); if ( ! empty( $attributes['taxonomies'] ) ) { foreach ( $attributes['taxonomies'] as $taxonomy ) { $tags = get_the_terms( get_the_ID(), $taxonomy ); if ( ! empty( $tags ) ) { $query_vars['tax_query'][] = array( 'taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => wp_list_pluck( $tags, 'term_id' ), ); } } if ( count( $query_vars['tax_query'] ) > 1 ) { $query_vars['tax_query']['relation'] = 'OR'; } } $attributes['query_vars'] = $query_vars; /** * Filters the Related Posts carousel attributes. * * @param array $attributes The Related Posts carousel attributes. * @param string $post_type Current post type. */ $attributes = apply_filters( 'tripp_related_posts_attributes', $attributes, $post_type ); $block = array( 'blockName' => 'flextension/post-carousel', 'attrs' => $attributes, ); echo render_block( $block ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } if ( ! function_exists( 'tripp_related_posts' ) ) { /** * Displays the related posts section. */ function tripp_related_posts() { if ( get_theme_mod( 'blog_single_post_related', false ) || is_customize_preview() ) { get_template_part( 'template-parts/single/related' ); } } } if ( ! function_exists( 'tripp_posts_not_found' ) ) { /** * Prints out the message when there are no posts to show. */ function tripp_posts_not_found() { if ( 'following' === get_query_var( 'filter' ) && ! tripp_user_has_following() ) { echo '