post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
Tags : ' . __( '%1$s ', 'beautify' ) . '', $tags_list );
}
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
if ( ! function_exists( 'beautify_categorized_blog' ) ) :
function beautify_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'beautify_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( 'beautify_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so beautify_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so beautify_categorized_blog should return false.
return false;
}
}
endif;
/**
* Flush out the transients used in beautify_categorized_blog.
*/
if ( ! function_exists( 'beautify_category_transient_flusher' ) ) :
function beautify_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'beautify_categories' );
}
endif;
add_action( 'edit_category', 'beautify_category_transient_flusher' );
add_action( 'save_post', 'beautify_category_transient_flusher' );
// Recent Posts with featured Images to be displayed on home page
if( ! function_exists('beautify_recent_posts') ) {
function beautify_recent_posts() {
$output = '';
$posts_per_page = get_theme_mod('recent_posts_count', 2 );
$post_ID = explode (',',get_theme_mod('recent_posts_exclude'));
// WP_Query arguments
$args = array (
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => intval($posts_per_page),
'ignore_sticky_posts' => true,
'order' => 'DESC',
'post__not_in' => $post_ID,
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
$output .= '
';
}
$query = null;
// Restore original Post Data
wp_reset_postdata();
echo $output;
}
}
/**
* Generates Breadcrumb Navigation
*/
if( ! function_exists( 'beautify_breadcrumbs' )) {
function beautify_breadcrumbs() {
/* === OPTIONS === */
$text['home'] = __( 'Home','beautify' ); // text for the 'Home' link
$text['category'] = __( 'Archive by Category "%s"','beautify' ); // text for a category page
$text['search'] = __( 'Search Results for "%s" Query','beautify' ); // text for a search results page
$text['tag'] = __( 'Posts Tagged "%s"','beautify' ); // text for a tag page
$text['author'] = __( 'Articles Posted by %s','beautify' ); // text for an author page
$text['404'] = __( 'Error 404','beautify' ); // text for the 404 page
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$breadcrumb_char = get_theme_mod( 'breadcrumb_char', '1' );
if ( $breadcrumb_char ) {
switch ( $breadcrumb_char ) {
case '2' :
$delimiter = ' / ';
break;
case '3':
$delimiter = ' > ';
break;
case '1':
default:
$delimiter = ' » ';
break;
}
}
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
/* === END OF OPTIONS === */
global $post;
$homeLink = esc_url(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 '