%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '%2$s %4$s ';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
$year = get_the_time( 'Y' );
$month = get_the_time( 'm' );
$day = get_the_time( 'd' );
$permalink = get_day_link( $year, $month, $day );
$posted_on = sprintf(
/* translators: %s: post date. */
esc_html_x( '%s', 'post date', 'astha' ),
'' . $time_string . ' '
);
echo ' ' . $posted_on . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'astha_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function astha_posted_by() {
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x( 'By %s', 'post author', 'astha' ),
'' . esc_html( get_the_author() ) . ' '
);
echo ' ' . $byline . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'astha_taxonomy_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function astha_taxonomy_by() {
if ( 'post' === get_post_type() ) {
$blog_meta_tax = apply_filters( 'astha_blog_meta_taxonomy', 'cat' );
$taxonomy_list = false;
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'astha' ) );
if ( $categories_list && $blog_meta_tax == 'cat' ) {
$taxonomy_list = $categories_list;
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'astha' ) );
if ( $tags_list && $blog_meta_tax == 'tag' ) {
$taxonomy_list = $tags_list;
}
if( $taxonomy_list ){
printf( ' ' . esc_html__( '%1$s', 'astha' ) . ' ', $taxonomy_list );
}
}
}
endif;
// if( ! function_exists( 'astha_comment_link' ) ) :
// /**
// * Prints the total comment number and links to there.
// */
// function astha_comment_link() {
// if( 'post' === get_post_type() ) {
// }
// }
// endif;
if ( ! function_exists( 'astha_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function astha_entry_footer() {
/**
* Tax link
* such: Category Link Or
* Tag link showing
* Validation
* using Filter: astha_entry_footer_tax_link
*/
$tax_link = apply_filters( 'astha_entry_footer_tax_link', true );
// Hide category and tag text for pages.
if ( 'post' === get_post_type() && $tax_link ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ' ', 'astha' ) );
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ' ', 'list item separator', 'astha' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '' . esc_html__( '%1$s', 'astha' ) . ' ', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}elseif ( $categories_list ) {
/* translators: 1: list of categories. */
printf( '' . esc_html__( 'In %1$s', 'astha' ) . ' ', $categories_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
/**
* Adding Share Button
* At the bottom of Post
*
* @Hooked: astha_social_share -10 at inc/template-functions.php file
*
* used: add_action( 'astha_share', 'astha_social_share' );
* To removed Social Share at Post,
* Just use
* remove_action( 'astha_share', 'astha_social_share' );
*/
do_action( 'astha_share' );
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit %s ', 'astha' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
),
'',
' '
);
}
endif;
if ( ! function_exists( 'astha_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function astha_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
the_title_attribute(
array(
'echo' => false,
)
),
)
);
/**
* Posted on inside Thumbnail image
* on Blog Page and when is not single
* page, Even when enabled from customizer
*
* @since 1.0.0.62
*/
if( ! empty( astha_option( 'astha_blog_posted_on', 'on' ) ) && astha_blog_layout() == 'grid' ){
?>
user_id > 0 ) {
$user = get_userdata( $comment->user_id );
$post = get_post( $comment->comment_post_ID );
if ( ! empty( $user ) && ! empty( $post ) ) {
return $comment->user_id === $post->post_author;
}
}
return false;
}
/**
* WordPress Breadcrumb for Astha Theme
*
* Credit decleared at Link
*
* @link https://github.com/ahmedhere/wp-breadcrumb-function
*
*
* @global type $post
* @global type $author
* @return void
*/
function astha_breadcrumb() {
$separator = apply_filters( 'astha_breadcrumb_separator', '' );
$wooBreadCumb = apply_filters( 'astha_wc_breadcrumb', true );
/**
* First We will try to load Woocommerce Default Breadcrumb
* Because, WooComemrce has a Nice Breadcrumb System
*
* WooCommerce Plugin -> Includes -> wc-template-functions.php
*/
if( $wooBreadCumb && function_exists( 'woocommerce_breadcrumb' ) ){
$args = array(
'delimiter' => ' ' . $separator . ' ',
);
$args = apply_filters( 'astha_wc_breadcrumb_args', $args );
woocommerce_breadcrumb( $args );
return true;
}
// Check if is front/home page, return
if ( is_front_page() ) {
return;
}
// Define
global $post;
$custom_taxonomy = ''; // If you have custom taxonomy place it here
$defaults = array(
'seperator' => $separator,//'»',
'id' => 'astha-breadcrumb',
'classes' => 'astha-breadcrumb',
'home_title' => esc_html__( 'Home', 'astha' )
);
$sep = '';
if( ! empty( $separator )){
$sep = ''. esc_html( $defaults['seperator'] ) .' ';
}
// Start the breadcrumb with a link to your homepage
echo '';
// Creating home link
echo ''. esc_html( $defaults['home_title'] ) .' ' . $sep;
if ( is_single() ) {
// Get posts type
$post_type = get_post_type();
// If post type is not post
if( $post_type != 'post' ) {
$post_type_object = get_post_type_object( $post_type );
$post_type_link = get_post_type_archive_link( $post_type );
echo ''. $post_type_object->labels->name .' '. $sep;
}
// Get categories
$category = get_the_category( $post->ID );
// If category not empty
if( !empty( $category ) ) {
// Arrange category parent to child
$category_values = array_values( $category );
$get_last_category = end( $category_values );
// $get_last_category = $category[count($category) - 1];
$get_parent_category = rtrim( get_category_parents( $get_last_category->term_id, true, ',' ), ',' );
$cat_parent = explode( ',', $get_parent_category );
// Store category in $display_category
$display_category = '';
foreach( $cat_parent as $p ) {
$display_category .= ''. $p .' ' . $sep;
}
}
// If it's a custom post type within a custom taxonomy
$taxonomy_exists = taxonomy_exists( $custom_taxonomy );
if( empty( $get_last_category ) && !empty( $custom_taxonomy ) && $taxonomy_exists ) {
$taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
$cat_id = $taxonomy_terms[0]->term_id;
$cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
$cat_name = $taxonomy_terms[0]->name;
}
// Check if the post is in a category
if( !empty( $get_last_category ) ) {
echo $display_category;
echo ''. get_the_title() .' ';
} else if( !empty( $cat_id ) ) {
echo ''. $cat_name .' ' . $sep;
echo ''. get_the_title() .' ';
} else {
echo ''. get_the_title() .' ';
}
} else if( is_archive() ) {
if( is_tax() ) {
// Get posts type
$post_type = get_post_type();
// If post type is not post
if( $post_type != 'post' ) {
$post_type_object = get_post_type_object( $post_type );
$post_type_link = get_post_type_archive_link( $post_type );
echo '' . $post_type_object->labels->name . ' ' . $sep;
}
$custom_tax_name = get_queried_object()->name;
echo ''. $custom_tax_name .' ';
} else if ( is_category() ) {
$parent = get_queried_object()->category_parent;
if ( $parent !== 0 ) {
$parent_category = get_category( $parent );
$category_link = get_category_link( $parent );
echo ''. $parent_category->name .' ' . $sep;
}
echo ''. single_cat_title( '', false ) .' ';
} else if ( is_tag() ) {
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args = 'include=' . $term_id;
$terms = get_terms( $taxonomy, $args );
$get_term_name = $terms[0]->name;
// Display the tag name
echo ''. $get_term_name .' ';
} else if( is_day() ) {
// Day archive
// Year link
echo ''. get_the_time('Y') . ' Archives ' . $sep;
// Month link
echo ''. get_the_time('M') .' Archives ' . $sep;
// Day display
echo ''. get_the_time('jS') .' '. get_the_time('M'). ' Archives ';
} else if( is_month() ) {
// Month archive
// Year link
echo ''. get_the_time('Y') . ' Archives ' . $sep;
// Month Display
echo ''. get_the_time('M') .' Archives ';
} else if ( is_year() ) {
// Year Display
echo ''. get_the_time('Y') .' Archives ';
} else if ( is_author() ) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata( $author );
// Display author name
echo ''. 'Author: '. $userdata->display_name . ' ';
} else {
echo ''. post_type_archive_title() .' ';
}
} else if ( is_page() ) {
// Standard page
if( $post->post_parent ) {
// If child page, get parents
$anc = get_post_ancestors( $post->ID );
// Get parents in the right order
$anc = array_reverse( $anc );
// Parent page loop
if ( !isset( $parents ) ) $parents = null;
foreach ( $anc as $ancestor ) {
$parents .= ''. get_the_title( $ancestor ) .' ' . $sep;
}
// Display parent pages
echo $parents;
// Current page
echo ''. get_the_title() .' ';
} else {
// Just display current page if not parents
echo ''. get_the_title() .' ';
}
} else if ( is_search() ) {
// Search results page
echo 'Search results for: '. get_search_query() .' ';
} else if ( is_404() ) {
// 404 page
echo '' . 'Error 404' . ' ';
}
// End breadcrumb
echo ' ';
}