', $tags_list ); // WPCS: XSS OK.
}
}
endif;
if ( ! function_exists( 'maker_entry_author' ) ) :
/**
* Displays link to all posts written by an author of the current post.
*/
function maker_entry_author() {
printf(
'%s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
}
endif;
if ( ! function_exists( 'maker_entry_date' ) ) :
/**
* Displays Date of the current post.
*/
function maker_entry_date() {
$time_string = '';
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() )
);
printf( '%s', // WPCS: XSS OK.
esc_url( get_permalink() ),
$time_string
);
}
endif;
if ( ! function_exists( 'maker_pageviews' ) ) :
/**
* Displays Date of the current post.
*/
function maker_pageviews() {
if ( ! has_action( 'pageviews' ) ) {
return;
}
printf( '%1$s %2$s', // WPCS: XSS OK.
Pageviews::get_placeholder( get_the_ID() ),
''
);
}
endif;
if ( ! function_exists( 'maker_entry_comments_link' ) ) :
/**
* Prints HTML with a link to post comments.
*/
function maker_entry_comments_link() {
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
if ( intval( get_comments_number() ) == 0 ) {
return;
}
echo '';
comments_popup_link(
__( 'Leave a comment', 'maker' ),
__( 'One Comment', 'maker' ),
__( '% Comments', 'maker' )
);
echo '';
}
}
endif;
if ( ! function_exists( 'maker_entry_meta_before_content' ) ) :
/**
* Prints HTML with meta information for the current post.
*/
function maker_entry_meta_before_content() {
// Only display meta on posts.
if ( 'post' == get_post_type() ) {
echo '
';
endif;
}
endif;
if ( ! function_exists( 'maker_entry_meta_after_content' ) ) :
/**
* Prints HTML with meta after page content.
*/
function maker_entry_meta_after_content() {
// Hide category and tag text for pages.
if ( 'post' == get_post_type() ) {
$tags_list = get_the_tag_list( '', '' );
if ( $tags_list ) {
printf( '', $tags_list ); // WPCS: XSS OK.
}
} elseif ( 'page' == get_post_type() && current_user_can( 'edit_pages' ) ) {
echo '';
}
}
endif;
if ( ! function_exists( 'maker_post_thumbnail' ) ) :
/**
* Displays post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index
* view, or a div element on single view.
*/
function maker_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( 'jetpack-portfolio' == get_post_type() || 'portfolio' == get_post_type() ) {
printf( '', esc_url( apply_filters( 'the_permalink', get_permalink() ) ) );
the_post_thumbnail( '480x480' );
echo '';
} elseif ( is_singular() ) {
echo '
', $args['next_text'] );
// Only add markup if there's somewhere to navigate to.
if ( $previous || $next ) {
echo _navigation_markup( $next . $previous, 'post-navigation', $args['screen_reader_text'] ); // WPCS: XSS OK.
}
}
endif;
if ( ! function_exists( 'maker_get_portfolio_all_projects_link' ) ) :
/**
* Returns the markup for the "All Projects" link.
*
* @return string Link Markup.
*/
function maker_get_portfolio_all_projects_link() {
// Detect the type of the link.
switch ( get_theme_mod( 'portfolio_all_projects_link_type', 'archive' ) ) {
case 'frontpage':
$url = get_site_url();
break;
case 'custom':
$url = get_theme_mod( 'project_all_projects_link', get_post_type_archive_link( get_post_type() ) );
break;
default:
$url = get_post_type_archive_link( get_post_type() );
break;
}
// Return the link.
return sprintf(
'%2$s',
esc_url( $url ),
esc_html__( 'All Projects', 'maker' )
);
}
endif;
if ( ! function_exists( 'maker_portfolio_navigation' ) ) :
/**
* Displays Post Navigation a.k.a Next/Prev Post links on a single post page.
*/
function maker_portfolio_navigation() {
$prev = '';
$next = '';
// Get URLs of a previous and next portfolio items.
$prev_url = get_permalink( get_adjacent_post( false, '', false ) );
$next_url = get_permalink( get_adjacent_post( false, '', true ) );
if ( get_permalink() != $prev_url ) {
$prev = sprintf(
'%s',
esc_url( $prev_url ),
esc_html__( 'Prev', 'maker' )
);
}
if ( get_permalink() != $next_url ) {
$next = sprintf(
'%s',
esc_url( $next_url ),
esc_html__( 'Next', 'maker' )
);
}
// Only add markup if there's somewhere to navigate to.
if ( $prev || $next ) {
echo _navigation_markup( $prev . maker_get_portfolio_all_projects_link() . $next, 'pagination', __( 'Portfolio navigation', 'maker' ) ); // WPCS: XSS OK.
}
}
endif;
if ( ! function_exists( 'maker_comment_navigation' ) ) :
/**
* Displays Comment Navigation.
*/
function maker_comment_navigation() {
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
ThemePatio'
);
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function maker_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'maker_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( 'maker_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so maker_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so maker_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in maker_categorized_blog.
*/
function maker_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
delete_transient( 'maker_categories' );
}
add_action( 'edit_category', 'maker_category_transient_flusher' );
add_action( 'save_post', 'maker_category_transient_flusher' );