' . $logo . '' : $logo;
} elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) {
// Copied from jetpack_the_site_logo() function.
$logo = site_logo()->logo;
$logo_id = get_theme_mod( 'custom_logo' ); // Check for WP 4.5 Site Logo
$logo_id = $logo_id ? $logo_id : $logo['id']; // Use WP Core logo if present, otherwise use Jetpack's.
$size = site_logo()->theme_size();
$html = sprintf( '%2$s ',
esc_url( home_url( '/' ) ),
wp_get_attachment_image(
$logo_id,
$size,
false,
array(
'class' => 'site-logo attachment-' . $size,
'data-size' => $size,
'itemprop' => 'logo'
)
)
);
$html = apply_filters( 'jetpack_the_site_logo', $html, $logo, $size );
} else {
$tag = is_home() ? 'h1' : 'div';
$html = '<' . esc_attr( $tag ) . ' class="beta site-title">' . esc_html( get_bloginfo( 'name' ) ) . ' ' . esc_attr( $tag ) .'>';
if ( '' !== get_bloginfo( 'description' ) ) {
$html .= '' . esc_html( get_bloginfo( 'description', 'display' ) ) . '
';
}
}
if ( ! $echo ) {
return $html;
}
echo $html;
}
}
if ( ! function_exists('basepress_primary_navigation') ) {
function basepress_primary_navigation() {
?>
'primary',
'menu_id' => 'primary-navigation',
'container' => '',
'menu_class' => 'main-navigation-menu',
'echo' => true,
'fallback_cb' => 'basepress_default_menu',
)
);
?>
'none',
'custom_header_hide' => false,
'custom_header_link' => ''
));
// Display featured image as header image on static pages
if( is_page() && has_post_thumbnail() ) : ?>
Header
elseif( get_header_image() ) :
// Hide header image on front page
if ( true == $theme_options['custom_header_hide'] and ( is_front_page() || is_archive() || is_search() ) ) {
return;
}
?>
'paging-numberal'
));
$nav_style = $theme_options['paging'];
if ( $nav_style == 'paging-numberal') {
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( ' ', 'basepress' ),
'next_text' => __( ' ', 'basepress' ),
'before_page_number' => '' . __( 'Page', 'basepress' ) . ' ',
) );
} else {
$args = array(
'prev_text' => __( ' Older Posts', 'basepress' ),
'next_text' => __( 'Newer Posts ', 'basepress' )
);
the_posts_navigation($args);
}
}
endif;
if ( ! function_exists( 'basepress_post_header' ) ) {
/**
* Display the post header with a link to the single post
*
* @since 1.0.0
*/
function basepress_post_header() {
do_action( 'basepress_before_post_title');
if ( is_single() ) {
the_title( '', ' ' );
} else {
the_title( sprintf( '' );
}
do_action( 'basepress_after_post_title');
}
}
if ( ! function_exists('basepress_post_header_wrapper') ) {
function basepress_post_header_wrapper() {
echo ' ';
}
}
if ( ! function_exists( 'basepress_homepage_content' ) ) {
/**
* Display homepage content
* Hooked into the `homepage` action in the homepage template
*
* @since 1.0.0
* @return void
*/
function basepress_homepage_content() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', 'page' );
} // end of the loop.
}
}
if ( ! function_exists( 'basepress_post_content' ) ) {
/**
* Display the post content with a link to the single post
*
* @since 1.0.0
*/
function basepress_post_content() {
/**
* Functions hooked in to basepress_post_content_before action.
*
* @hooked basepress_post_thumbnail - 10
*/
do_action( 'basepress_post_content_before');
echo '';
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue Reading %s → ', 'basepress' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '"', '" ', false )
) );
echo '
';
/**
* Functions hooked in basepress_post_content_after
*
* @hooked basepress_entry_meta_footer - 10
*/
do_action( 'basepress_post_content_after' );
wp_link_pages( array(
'before' => '' . esc_html__( 'Pages:', 'basepress' ),
'after' => '
',
) );
}
}
if ( ! function_exists( 'basepress_post_single_content' ) ) {
/**
* Display the post content with a link to the single post
*
* @since 1.0.0
*/
function basepress_post_single_content() {
/**
* Functions hooked in to basepress_post_content_before action.
*
* @hooked basepress_post_thumbnail - 10
*/
do_action( 'basepress_post_single_content_before');
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue Reading %s → ', 'basepress' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '"', '" ', false )
) );
do_action( 'basepress_post_single_content_after' );
wp_link_pages( array(
'before' => '' . esc_html__( 'Pages:', 'basepress' ),
'after' => '
',
) );
}
}
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() {
// Get tags.
$tag_list = get_the_tag_list( '', __(', ', 'basepress') );
// Display tags.
if ( $tag_list ) : ?>
'%title',
'prev_text' => '%title',
);
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 = 'thumbnail' ) {
if ( has_post_thumbnail() ) {
?>
"', '"', 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'
));
$metadata = array_flip($metadata);
$postmeta .= isset($metadata['date']) ? $prefix['date'] . basepress_meta_date() : '';
$postmeta .= isset($metadata['author']) ? $prefix['author'] . basepress_meta_author() : '';
$postmeta .= isset($metadata['category']) ? $prefix['category'] . basepress_meta_category() : '';
$postmeta .= isset($metadata['tag']) ? $prefix['tag'] . basepress_meta_tag() : '';
$postmeta .= isset($metadata['comment']) ? $prefix['comment'] . basepress_meta_comments() : '';
if ( $postmeta ) { ?>
%4$s ',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
return '' . $time_string . ' ';
}
endif;
if ( ! function_exists( 'basepress_meta_author' ) ) :
/**
* Displays the post author
*/
function basepress_meta_author() {
$author_string = sprintf( '%3$s ',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( esc_html__( 'View all posts by %s', 'basepress' ), get_the_author() ) ),
esc_html( get_the_author() )
);
return '' . wp_kses_post($author_string) . ' ';
}
endif;
if ( ! function_exists( 'basepress_meta_category' ) ) :
/**
* Displays the category of posts
*/
function basepress_meta_category() {
$categories_list = get_the_category_list( ', ' );
if ( $categories_list ) {
return ' ' . wp_kses_post($categories_list) . ' ';
}
}
endif;
if ( ! function_exists( 'basepress_meta_tag' ) ) :
/**
* Displays the category of posts
*/
function basepress_meta_tag() {
$tags_list = get_the_tag_list( '', __( ', ', 'basepress' ) );
if ( $tags_list ) {
return ' ' . wp_kses_post( $tags_list ) . ' ';
}
}
endif;
if ( ! function_exists( 'basepress_meta_comments' ) ) :
/**
* Displays the category of posts
*/
function basepress_meta_comments() {
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
$txt_comment = ''.get_comments_number_text( __('Leave a Comment', 'basepress'), __('One Comment', 'basepress'), __('% Comments', 'basepress')) . ' ';
return '';
}
}
endif;
if ( ! function_exists( 'basepress_meta_edit_link' ) ) :
/**
* Displays the category of posts
*/
function basepress_meta_edit_link() {
return ' ' . get_the_category_list( ', ' ) . ' ';
}
endif;
if ( ! function_exists( 'basepress_get_sidebar' ) ) {
/**
* Display base sidebar
*
* @uses get_sidebar()
* @since 1.0.0
*/
function basepress_get_sidebar() {
get_sidebar();
}
}
if ( ! function_exists( 'basepress_header_widget_region' ) ) {
/**
* Display header widget region
*
* @since 1.0.0
*/
function basepress_header_widget_region() {
if ( is_active_sidebar( 'header-1' ) ) {
?>
0 ) : ?>
';
}
}
if ( ! function_exists( 'basepress_credit_wrapper_close' )) {
/**
* Credit close wrapper
*/
function basepress_credit_wrapper_close() {
echo '
';
}
}
if ( ! function_exists( 'basepress_footer_nav' ) ) {
/**
* Display footer menu
*
* @since 1.0.0
* @return void
*/
function basepress_footer_nav() {
// Check if there is a footer menu.
if ( has_nav_menu( 'footer' ) ) {
echo '';
}
}
}
if ( ! function_exists( 'basepress_credit' ) ) {
/**
* Display the theme credit
*
* @since 1.0.0
* @return void
*/
function basepress_credit() {
?>
ThemeCountry' ); ?>
'
' . __( 'Pages:', 'basepress' ),
'after' => '
',
) );
?>
'webpage',
'@id' => get_the_permalink(),
);
$json['publisher'] = array(
'@type' => 'organization',
'name' => get_bloginfo( 'name' ),
'logo' => array(
'@type' => 'ImageObject',
'url' => $logo[0],
'width' => $logo[1],
'height' => $logo[2],
),
);
$json['author'] = array(
'@type' => 'person',
'name' => get_the_author(),
);
if ( $image ) {
$json['image'] = array(
'@type' => 'ImageObject',
'url' => $image[0],
'width' => $image[1],
'height' => $image[2],
);
}
$json['datePublished'] = get_post_time( 'c' );
$json['dateModified'] = get_the_modified_date( 'c' );
$json['name'] = get_the_title();
$json['headline'] = $json['name'];
$json['description'] = get_the_excerpt();
// Page's structured data.
} elseif ( is_page() ) {
$json['@type'] = 'WebPage';
$json['url'] = get_the_permalink();
$json['name'] = get_the_title();
$json['description'] = get_the_excerpt();
}
if ( isset( $json ) ) {
BasePress::set_structured_data( apply_filters( 'basepress_structured_data', $json ) );
}
}
}
if ( ! function_exists( 'basepress_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function basepress_posted_on() {
$meta_items = apply_filters('basepress_posted_metadata', array(
'meta-date' => true,
'meta-au' => true,
));
$time_string = '%2$s ';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '%4$s ';
//$time_string = '%2$s %4$s ';
}
$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( '%s', 'post date', 'basepress' ),
'' . $time_string . ' '
);
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'basepress' ),
'' . esc_html( get_the_author() ) . ' '
);
if ( isset( $meta_items['meta-date'] ) ) {
echo '' . $posted_on . ' ';
}
if ( isset( $meta_items['meta-au'] ) ) {
echo '' . $byline . ' ';
}
}
endif;
if ( ! function_exists( 'basepress_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function basepress_entry_footer() {
$meta_items = apply_filters('basepress_posted_metadata_footer', array(
'meta-cat' => true,
'meta-com' => true,
));
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
if ( isset( $meta_items['meta-cat'] ) ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'basepress' ) );
if ( $categories_list && basepress_categorized_blog() ) {
printf( '' . esc_html__( '%1$s', 'basepress' ) . ' ', $categories_list ); // WPCS: XSS OK.
}
}
}
if ( isset( $meta_items['meta-com'] ) ) {
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
}
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'basepress' ),
the_title( '"', '" ', false )
),
'',
' '
);
}
endif;