'primary',
'menu_id' => 'primary-menu',
'show_toggles' => true
) );
} else {
wp_page_menu( array(
'title_li' => '',
'show_toggles' => true,
'walker' => new BNM_Walker_Page()
) );
}
}
endif;
if ( ! function_exists( 'bnm_secondary_nav' ) ) :
/**
* Displays secondary navigation.
*/
function bnm_secondary_nav() {
wp_nav_menu( array(
'theme_location' => 'secondary',
'menu_id' => 'secondary-menu',
'show_toggles' => true
) );
}
endif;
if ( ! function_exists( 'bnm_social_nav' ) ) :
/**
* Displays social navigation.
*/
function bnm_social_nav() {
if ( has_nav_menu( 'social' ) ) : ?>
%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
add_filter( 'get_the_modified_date', 'bnm_convert_modified_to_time_ago', 10, 3 );
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
remove_filter( 'get_the_modified_date', 'bnm_convert_modified_to_time_ago', 10, 3 );
$posted_on = sprintf(
'' . $time_string . ''
);
echo '' . $posted_on . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'bnm_author_avatar' ) ) :
function bnm_author_avatar() {
$author_email = get_the_author_meta( 'user_email' );
$avatar_url = get_avatar_url( $author_email );
echo '
';
}
endif;
if ( ! function_exists( 'bnm_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function bnm_posted_by() {
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x( 'by %s', 'post author', 'bnm' ),
'' . esc_html( get_the_author() ) . ''
);
echo ' ' . $byline . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'bnm_categories' ) ) :
/**
* Prints the category list
*/
function bnm_categories() {
if ( 'post' === get_post_type() ) {
if ( is_single() ) {
$show_category_list = get_theme_mod( 'bnm_show_cat_links_s', true );
} else {
$show_category_list = get_theme_mod( 'bnm_show_cat_links', true );
}
if ( ! $show_category_list ) {
return;
}
/* translators: used between category list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ' / ', 'bnm' ) );
if ( $categories_list ) {
/* translators: 1: posted in label 2: list of categories. */
printf(
'%1$s%2$s',
esc_html__( 'Posted in', 'bnm' ),
apply_filters( 'bnm_theme_categories', $categories_list )
); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
endif;
if ( ! function_exists( 'bnm_tags_list' ) ) :
/**
* Prints the tags list
*/
function bnm_tags_list() {
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'bnm' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '' . esc_html__( 'Tagged %1$s', 'bnm' ) . '', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
endif;
if ( ! function_exists( 'bnm_comments_link' ) ) :
/**
* Prints comments link
*/
function bnm_comments_link() {
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
echo '';
}
}
endif;
if ( ! function_exists( 'bnm_entry_meta' ) ) :
/**
* Entry Meta
*/
function bnm_entry_meta() {
if ( is_single() ) {
$show_date = get_theme_mod( 'bnm_show_date_s', true );
$show_avatar = get_theme_mod( 'bnm_show_author_avatar_s', true );
$show_author = get_theme_mod( 'bnm_show_author_s', true );
$show_comments = get_theme_mod( 'bnm_show_comments_link_s', true );
} else {
$show_date = get_theme_mod( 'bnm_show_date', true );
$show_avatar = get_theme_mod( 'bnm_show_author_avatar', false );
$show_author = get_theme_mod( 'bnm_show_author', true );
$show_comments = get_theme_mod( 'bnm_show_comments_link', true );
}
if ( $show_avatar ) {
bnm_author_avatar();
}
if ( $show_author ) {
bnm_posted_by();
}
if ( $show_date ) {
bnm_posted_on();
}
if ( $show_comments ) {
bnm_comments_link();
}
}
endif;
if ( ! function_exists( 'bnm_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function bnm_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 */
$tags_list = get_the_tag_list();
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf(
'%1$s%2$s
',
esc_html__( 'Tagged', 'bnm' ),
$tags_list
); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit %s', 'bnm' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
),
'',
''
);
}
endif;
if ( ! function_exists( 'bnm_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function bnm_post_thumbnail( $size = 'bnm-featured-image' ) {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
'' . esc_html__( 'Next Article', 'bnm' ) . ' ' .
'' . esc_html__( 'Next article:', 'bnm' ) . '
' .
'%title',
'prev_text' => '' . esc_html__( 'Previous Article', 'bnm' ) . ' ' .
'' . esc_html__( 'Previous article:', 'bnm' ) . '
' .
'%title',
)
);
}
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Shim for sites older than 5.2.
*
* @link https://core.trac.wordpress.org/ticket/12563
*/
function wp_body_open() {
do_action( 'wp_body_open' );
}
endif;
if ( ! function_exists( 'bnm_search_box' ) ) :
/**
* Displays the search
*/
function bnm_search_box() {
?>
__( '← Older Posts', 'bnm' ),
'next_text' => __( 'Newer Posts →', 'bnm' ),
)
);
}
}
}
if ( ! function_exists( 'bnm_read_more_button' ) ) {
/**
* Read More Button Markup
*/
function bnm_read_more_button() {
if ( 'button' === get_theme_mod( 'bnm_read_more_type', 'link' ) ) : ?>