'entry-title'.
*/
function tripp_post_title( $post = 0, $tag = '', $class = 'entry-title' ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
if ( true !== tripp_post_can_show( 'title', $post ) ) {
return;
}
if ( empty( $tag ) ) {
$tag = is_single( $post->ID ) ? 'h1' : 'h3';
}
/**
* Filters the HTML tag for the post title.
*
* @param array $tag The current HTML tag for the post title.
* @param WP_Post $post WP_Post object.
*/
$title_tag = apply_filters( 'tripp_post_title_tag', $tag, $post );
/**
* Filters the post title.
*
* @since 1.1.1.
*
* @param string $title The post title.
* @param WP_Post $post The post object.
*/
$title = apply_filters( 'tripp_post_title', get_the_title( $post ), $post );
if ( is_single( $post->ID ) ) {
echo '<' . $title_tag . ' class="' . esc_attr( $class ) . '">' . esc_html( $title ) . '' . $title_tag . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
$tooltip = the_title_attribute(
array(
'echo' => false,
'post' => $post,
)
);
$url = tripp_get_post_link( $post );
if ( 'link' === get_post_format( $post ) && ! empty( $url ) ) {
$link = '' . esc_html( $title ) . '';
} else {
$link = '' . esc_html( $title ) . '';
}
echo '<' . $title_tag . ' class="' . esc_attr( $class ) . '">' . $link . '' . $title_tag . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Fires after the post title is rendered.
*
* @since 1.1.1.
*
* @param WP_Post $post The post object.
*/
do_action( 'tripp_after_title', $post );
}
}
if ( ! function_exists( 'tripp_post_excerpt' ) ) {
/**
* Prints out the post excerpt.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
*/
function tripp_post_excerpt( $post = 0 ) {
/**
* If the post excerpt is enabled for the password protected post, return the excerpt.
*/
if ( post_password_required( $post ) ) {
if ( tripp_protected_post_can_show( 'excerpt', $post ) ) {
$excerpt = tripp_get_post_excerpt( $post );
if ( ! empty( $excerpt ) ) {
echo '
' . esc_html( $excerpt ) . '
';
}
} else {
echo get_the_password_form( $post ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
return;
}
the_excerpt();
}
}
if ( ! function_exists( 'tripp_get_more_link' ) ) {
/**
* Returns a 'Read more' link to append to the post excerpt.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @param string $text Link text. Default 'Read more'.
* @param string $url Link URL.
* @param string $tooltip Link tooltip. Default 'Continue reading %s'.
* @return string A 'Read more' link HTML.
*/
function tripp_get_more_link( $post = 0, $text = '', $url = '', $tooltip = '' ) {
if ( true !== tripp_post_can_show( 'excerpt', $post ) ) {
return;
}
if ( empty( $text ) ) {
$text = esc_html__( 'Read more', 'tripp' );
}
if ( empty( $url ) ) {
$url = get_permalink( $post );
}
if ( empty( $tooltip ) ) {
$tooltip = sprintf(
/* translators: %s: Post title. */
esc_html__( 'Continue reading %s', 'tripp' ),
the_title_attribute(
array(
'before' => '"',
'after' => '"',
'echo' => false,
'post' => $post,
)
)
);
}
return sprintf(
'
%3$s
',
esc_url( $url ),
esc_attr( $tooltip ),
esc_html( $text )
);
}
}
if ( ! function_exists( 'tripp_more_link' ) ) {
/**
* Prints out a 'Read more' link.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @param string $text Link text. Default 'Read more'.
* @param string $url Link URL.
*/
function tripp_more_link( $post = 0, $text = '', $url = '' ) {
echo tripp_get_more_link( $post, $text, $url ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if ( ! function_exists( 'tripp_category_thumbnail' ) ) {
/**
* Returns the featured image for the term.
*
* @param string $term_id The term ID.
* @param string|array $size The post thumbnail size. Image size or array of width and height
* values (in that order). Default 'post-thumbnail'.
* @return string The term's featured image.
*/
function tripp_category_thumbnail( $term_id = '', $size = '' ) {
$image = '';
if ( function_exists( 'tripp_xt_get_term_icon' ) ) {
$image = tripp_xt_get_term_icon( $term_id, $size );
}
if ( empty( $image ) && function_exists( 'flextension_get_term_thumbnail' ) ) {
$image = flextension_get_term_thumbnail( $term_id, $size );
}
return $image;
}
}
if ( ! function_exists( 'tripp_archive_thumbnail' ) ) {
/**
* Prints out the archive thumbnail.
*/
function tripp_archive_thumbnail() {
$thumbnail = '';
if ( is_author() ) {
$author = get_queried_object();
if ( ! empty( $author ) && isset( $author->ID ) ) {
$thumbnail = tripp_get_author_thumbnail( $author->ID, 150 );
if ( ! empty( $thumbnail ) ) {
$thumbnail .= tripp_get_author_follow_button( $author->ID );
}
}
} else {
$thumbnail = tripp_category_thumbnail( get_queried_object_id(), 'thumbnail' );
}
if ( ! empty( $thumbnail ) ) {
echo '' . $thumbnail . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
if ( ! function_exists( 'tripp_archive_title' ) ) {
/**
* Prints out the archive title.
*
* @param string $type The archive title type.
* @param string $tag Title tag.
*/
function tripp_archive_title( $type = '', $tag = 'h1' ) {
$overline = '';
$title = '';
$description = '';
if ( is_home() && is_front_page() ) {
$title = esc_html( get_bloginfo( 'name' ) );
$description = esc_html( get_bloginfo( 'description', 'display' ) );
} elseif ( is_day() ) {
$overline = esc_html__( 'Daily Archives', 'tripp' );
$title = tripp_get_date_archive_title( _x( 'F j, Y', 'daily archives date format', 'tripp' ) );
} elseif ( is_month() ) {
$overline = esc_html__( 'Monthly Archives', 'tripp' );
$title = tripp_get_date_archive_title( _x( 'F Y', 'monthly archives date format', 'tripp' ) );
} elseif ( is_year() ) {
$overline = esc_html__( 'Yearly Archives', 'tripp' );
$title = tripp_get_date_archive_title( _x( 'Y', 'yearly archives date format', 'tripp' ) );
} elseif ( is_author() ) {
$found_posts = isset( $GLOBALS['wp_query']->found_posts ) ? (int) $GLOBALS['wp_query']->found_posts : 0;
$overline = sprintf(
/* translators: %s: Post count number. */
esc_html( _nx( '%s entry by', '%s entries by', $found_posts, 'Post count number', 'tripp' ) ),
esc_html( number_format_i18n( $found_posts ) )
);
$title = get_the_author_meta( 'display_name', get_query_var( 'author' ) );
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} else {
$found_posts = isset( $GLOBALS['wp_query']->found_posts ) ? (int) $GLOBALS['wp_query']->found_posts : 0;
$overline = sprintf(
/* translators: %s: Post count number. */
esc_html( _nx( '%s entry in', '%s entries in', $found_posts, 'Post count number', 'tripp' ) ),
esc_html( number_format_i18n( $found_posts ) )
);
$title = single_cat_title( '', false );
}
/**
* Filters the archive overline.
*
* @param string $overline Archive overline.
* @param string $type The archive title type.
*/
$overline = apply_filters( 'tripp_archive_overline', $overline, $type );
/**
* Filters the archive title.
*
* @param string $title Archive title.
* @param string $type The archive title type.
*/
$title = apply_filters( 'tripp_archive_title', $title, $type );
/**
* Filters the archive description.
*
* @param string $description Archive description.
* @param string $type The archive title type.
*/
$description = apply_filters( 'tripp_archive_description', $description, $type );
if ( ! empty( $overline ) ) {
echo '' . $overline . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( ! empty( $title ) ) {
echo '<' . $tag . ' class="page-title">' . $title . '' . $tag . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( ! empty( $description ) ) {
echo '' . $description . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
if ( ! function_exists( 'tripp_search_title' ) ) {
/**
* Prints out the search page title.
*
* @param string $tag Title tag.
*/
function tripp_search_title( $tag = 'h1' ) {
$title = sprintf(
/* translators: %s: Search term. */
esc_html__( 'Results for ā%sā', 'tripp' ),
'' . esc_html( get_search_query() ) . ''
);
echo '<' . $tag . ' class="page-title">' . $title . '' . $tag . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$found_posts = isset( $GLOBALS['wp_query']->found_posts ) ? (int) $GLOBALS['wp_query']->found_posts : 0;
echo '';
printf(
esc_html(
/* translators: %d: The number of search results. */
_n(
'We found %d result for your search.',
'We found %d results for your search.',
$found_posts,
'tripp'
)
),
absint( $found_posts )
);
echo '';
}
}
if ( ! function_exists( 'tripp_archive_description' ) ) {
/**
* Prints out the archive description.
*/
function tripp_archive_description() {
$description = '';
if ( is_author() ) {
$author = get_queried_object();
if ( ! empty( $author ) && isset( $author->ID ) ) {
$description = tripp_author_description( $author->ID );
if ( function_exists( 'flextension_author_follow_numbers' ) ) {
$description = flextension_author_follow_numbers( $author->ID ) . $description;
}
}
} else {
$description = term_description();
}
if ( ! empty( $description ) ) {
echo '' . $description . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
if ( ! function_exists( 'tripp_single_post_footer' ) ) {
/**
* Prints out the post footer for the single post.
*
* @param array $args An array of options.
*/
function tripp_single_post_footer( $args = array() ) {
if ( true !== tripp_post_can_show( 'metadata' ) ) {
return;
}
$args = wp_parse_args(
$args,
array(
'tags' => get_theme_mod( 'blog_single_post_tags', true ),
'buttons' => get_theme_mod( 'blog_single_post_buttons', false ),
'author' => get_theme_mod( 'blog_single_post_author', false ),
)
);
$is_preview = is_customize_preview();
$show_tags = $args['tags'];
$show_buttons = $args['buttons'];
$show_author = $args['author'];
$tags_list = '';
if ( true === $show_tags ) {
$tags_list = get_the_term_list( get_the_ID(), 'post_tag' );
if ( is_wp_error( $tags_list ) || empty( $tags_list ) ) {
$tags_list = '';
$show_tags = false;
}
}
if ( $is_preview || $show_tags || $show_buttons || $show_author ) {
echo '';
}
}
}
if ( ! function_exists( 'tripp_single_post_author' ) ) {
/**
* 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 '' . esc_html__( 'You are not following any authors yet.', 'tripp' ) . '
';
} else {
echo '' . esc_html__( 'There are no posts to show right now.', 'tripp' ) . '
';
}
}
}
if ( ! function_exists( 'tripp_quick_view_content' ) ) {
/**
* Displays Quick View content.
*/
function tripp_quick_view_content() {
if ( get_theme_mod( 'blog_quick_view_full', false ) ) {
echo '';
the_content();
tripp_review_data();
tripp_coupon_data();
echo '
';
} else {
echo '';
tripp_post_excerpt();
tripp_more_link();
echo '
';
}
}
}
coupon – Nos Dushi Bida
Skip to the content