%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'magzen' ),
'' . $time_string . ''
);
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'magzen' ),
'' . esc_html( get_the_author() ) . ''
);
echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'magzen_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function magzen_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'magzen' ) );
if ( $categories_list && magzen_categorized_blog() ) {
printf( '' . esc_html__( 'Posted in %1$s', 'magzen' ) . '', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'magzen' ) );
if ( $tags_list ) {
printf( '' . esc_html__( 'Tagged %1$s', 'magzen' ) . '', $tags_list ); // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
/* translators: %s: post title */
comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', 'magzen' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) );
echo '';
}
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'magzen' ),
the_title( '"', '"', false )
),
'',
''
);
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function magzen_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'magzen_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'magzen_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so magzen_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so magzen_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in magzen_categorized_blog.
*/
function magzen_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'magzen_categories' );
}
add_action( 'edit_category', 'magzen_category_transient_flusher' );
add_action( 'save_post', 'magzen_category_transient_flusher' );
/* Theme Related Functions */
if ( ! function_exists( 'magzen_post_nav' ) ) :
/**
* Display navigation to next/previous post when applicable.
*/
function magzen_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
';
break;
case '1':
default:
$delimiter = ' » ';
break;
}
}
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
/* === END OF OPTIONS === */
global $post;
$homeLink = home_url() . '/';
$linkBefore = '';
$linkAfter = '';
$linkAttr = ' rel="v:url" property="v:title"';
$link = $linkBefore . '%2$s' . $linkAfter;
if (is_home() || is_front_page()) {
if ($showOnHome == 1) echo '
';
}
} // end magzen_breadcrumbs()
}
// Related Posts Function by Tags (call using magzen_related_posts(); ) /NecessarY/ May be write a shortcode?
if ( ! function_exists( 'magzen_related_posts' ) ) :
function magzen_related_posts() {
echo '
';
global $post;
$post_hierarchy = get_theme_mod('related_posts_hierarchy','1');
$relatedposts_per_page = get_option('post_per_page') ;
if($post_hierarchy == '1') {
$related_post_type = wp_get_post_tags($post->ID);
$tag_arr = '';
if($related_post_type) {
foreach($related_post_type as $tag) { $tag_arr .= $tag->slug . ','; }
$args = array(
'tag' => esc_html($tag_arr),
'numberposts' => intval( $relatedposts_per_page ), /* you can change this to show more */
'post__not_in' => array($post->ID)
);
}
}else {
$related_post_type = get_the_category($post->ID);
if ($related_post_type) {
$category_ids = array();
foreach($related_post_type as $category) {
$category_ids = $category->term_id;
}
$args = array(
'category__in' => absint($category_ids),
'post__not_in' => array($post->ID),
'numberposts' => intval( $relatedposts_per_page ),
);
}
}
if( $related_post_type ) {
$related_posts = get_posts($args);
if($related_posts) {
foreach ($related_posts as $post) : setup_postdata($post); ?>