',
) );
}
}
if ( ! function_exists( 'basepress_post_header_meta' ) ) {
function basepress_post_header_meta() {
basepress_post_metadata();
}
}
if ( ! function_exists( 'basepress_post_content_wrapper' ) ) {
function basepress_post_content_wrapper() {
echo '
';
}
}
if ( ! function_exists( 'basepress_post_content_wrapper_close' ) ) {
function basepress_post_content_wrapper_close() {
echo '
';
}
}
if ( ! function_exists( 'basepress_post_tags' ) ) :
/**
* Displays the post tags on single post view
*/
function basepress_post_tags() {
$metadata = array_flip( apply_filters('basepress_enable_post_metadata', array() ) );
// Get tags.
$tag_list = get_the_tag_list( '', __(', ', 'basepress') );
// Display tags.
if ( $metadata ) :
if ( isset( $metadata['tag'] ) ) :
?>
'%title',
'prev_text' => '%title',
);
$enable_postnav = apply_filters('basepress_enable_postnav', true);
if ( $enable_postnav ) {
the_post_navigation( $args );
}
}
}
if ( ! function_exists( 'basepress_display_comments' ) ) {
/**
* base display comments
*
* @since 1.0.0
*/
function basepress_display_comments() {
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
}
}
if ( ! function_exists( 'basepress_post_thumbnail' ) ) {
/**
* Display post thumbnail
*
* @var $size thumbnail size. thumbnail|medium|large|full|$custom
* @uses has_post_thumbnail()
* @uses the_post_thumbnail
* @param string $size the post thumbnail size.
* @since 1.0.0
*/
function basepress_post_thumbnail( $size = 'large' ) {
$featured_image_url = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
if ( ! empty( $featured_image_url ) ) {
?>
"', '"', false )
),
'',
''
);
}
}
if ( ! function_exists( 'basepress_categorized_blog' ) ) {
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function basepress_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'basepress_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( 'basepress_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so basepress_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so basepress_categorized_blog should return false.
return false;
}
}
}
/**
* Flush out the transients used in basepress_categorized_blog.
*/
function basepress_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'basepress_categories' );
}
add_action( 'edit_category', 'basepress_category_transient_flusher' );
add_action( 'save_post', 'basepress_category_transient_flusher' );
if ( ! function_exists ( 'basepress_post_metadata' ) ) :
/**
* Render post metat data
*
* @since 1.0.0
*/
function basepress_post_metadata() {
/**
* Prefix all post meta
*
* @var array
*/
$prefix = apply_filters('basepress_prefix_post_metadata', array(
'date' => '',
'author' => __('By ', 'basepress'),
'category' => '',
'comment' => '',
'tag' => '',
));
$postmeta = '';
/**
* Allow theme author enable or disable post meta data
*
* @var [type]
*/
$metadata = apply_filters('basepress_enable_post_metadata', array(
'date',
'author',
'category',
'tag',
'comment'
));
foreach ( $metadata as $md) {
switch ( $md ) {
case 'date':
$postmeta .= basepress_meta_date( $prefix[$md] );
break;
case 'author':
$postmeta .= basepress_meta_author( $prefix[$md] );
break;
case 'category':
$postmeta .= basepress_meta_category( $prefix[$md] );
break;
case 'tag':
$postmeta .= basepress_meta_tag( $prefix[$md] );
break;
case 'comment':
$postmeta .= basepress_meta_comments( $prefix[$md] );
break;
}
}
if ( $postmeta ) { ?>