%2$s';
/*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() )
);
$posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'brand' ),
'' . $time_string . ''
);
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'brand' ),
'' . esc_html( get_the_author_meta( 'nicename', $post->post_author ) ) . ''
);
if( function_exists('brand_get_default_blog') ) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_default_blog()
);
if($brand_settings['show_date'] === 'no') {
$posted_on='';
}
if($brand_settings['show_author'] === 'no') {
$byline='';
}
}
echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'brand_show_categories' ) ) :
function brand_show_categories() {
if( function_exists('brand_get_default_blog') ) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_default_blog()
);
if($brand_settings['show_categories'] === 'no') {
return false;
} else {
return true;
}
}
return true;
}
endif;
if ( ! function_exists( 'brand_show_tags' ) ) :
function brand_show_tags() {
if( function_exists('brand_get_default_blog') ) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_default_blog()
);
if($brand_settings['show_tags'] === 'no') {
return false;
} else {
return true;
}
}
return true;
}
endif;
if ( ! function_exists( 'brand_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function brand_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 */
$categories_list = get_the_category_list( esc_html__( ', ', 'brand' ) );
if ( $categories_list && brand_categorized_blog() && brand_show_categories() ) {
printf( ' ' . esc_html__( '%1$s', 'brand' ) . '', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'brand' ) );
if ( $tags_list && brand_show_tags() ) {
printf( ' ' . esc_html__( '%1$s', 'brand' ) . '', $tags_list ); // WPCS: XSS OK.
}
}
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', 'brand' ),
the_title( '"', '"', false )
),
'',
''
);
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function brand_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'brand_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( 'brand_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so brand_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so brand_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in brand_categorized_blog.
*/
function brand_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'brand_categories' );
}
add_action( 'edit_category', 'brand_category_transient_flusher' );
add_action( 'save_post', 'brand_category_transient_flusher' );
if ( ! function_exists( 'brand_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
* a 'Continue reading' link.
*
* Create your own brand_excerpt_more() function to override in a child theme.
*
* @since Brand 1.0.0
*
* @return string 'Continue reading' link prepended with an ellipsis.
*/
function brand_excerpt_more() {
$link = sprintf( '%2$s',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue reading "%s"', 'brand' ), get_the_title( get_the_ID() ) )
);
return ' … ' . $link;
}
add_filter( 'excerpt_more', 'brand_excerpt_more' );
endif;
if ( ! function_exists( 'brand_show_excerpt' )) :
function brand_show_excerpt() {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
$show_excerpt = $brand_settings['show_excerpt'];
return $show_excerpt;
}
endif;
if ( ! function_exists( 'brand_logo_inside_header' ) ) :
function brand_logo_inside_header() {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
if($brand_settings['logo_position'] !== 'inside_header') {
return;
}
$logos = brand_logo_urls();
if( $logos['logo'] === 0 && $logos['logo_mobile'] === 0 ) {
return;
}
$logo = $logos['logo'] !== 0 ? '
' : '';
$logo_mobile = $logos['logo_mobile'] !== 0 ? '
' : '';
printf(
'
',
apply_filters( 'brand_logo_href' , esc_url( home_url( '/' ) ) ),
apply_filters( 'brand_logo', $logo ),
apply_filters( 'brand_logo_mobile', $logo_mobile )
);
}
add_action('brand_before_site_title', 'brand_logo_inside_header' );
endif;
if ( ! function_exists( 'brand_logo_urls' ) ) :
function brand_logo_urls() {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
$logo_url = intval($brand_settings['logo']) !== 0 ? wp_get_attachment_url( $brand_settings['logo'] ) : 0;
$logo_mobile_url = intval($brand_settings['logo_mobile']) !== 0 ? wp_get_attachment_url( $brand_settings['logo_mobile'] ) : 0;
$logos = array( 'logo' => $logo_url, 'logo_mobile' => $logo_mobile_url );
return $logos;
}
endif;
if ( ! function_exists( 'brand_nav_search_icon' ) ) :
/**
* Add search icon to primary menu if set
*
* @since 1.0
*/
add_filter( 'wp_nav_menu_items','brand_nav_items', 10, 2 );
function brand_nav_items( $nav, $args )
{
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
// If the search icon and inline logo aren't enabled, return the regular nav
if ( 'enabled' !== $brand_settings['nav_search'] && 'inline' !== $brand_settings['logo_position'] )
return $nav;
$logo = '';
if( 'inline' === $brand_settings['logo_position'] ) {
$logos = brand_logo_urls();
if( $logos['logo'] !== 0 ) {
$logo_url = $logos['logo'];
} else {
$logo_url = 0;
}
$logo = $logo_url !== 0 ? '
' : '';
}
// If the search icon isn't enabled, return the regular nav
if ( 'enabled' !== $brand_settings['nav_search'] )
return $logo . $nav;
// If our primary menu is set, add the search icon
if( $args->theme_location == 'primary' )
return $logo . $nav . '';
// Our primary menu isn't set, return the regular nav
return $logo . $nav;
}
endif;
/**
* Add callback function if primary menu is not set
*
* @since 1.0
*/
if ( ! function_exists( 'brand_primary_menu_fb' ) ) :
function brand_primary_menu_fb($args) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
?>
' : '';
if ( 'yes' === $brand_settings['sticky_menu'] ) : ?>
' : '';
printf(
'
',
apply_filters( 'brand_logo_href' , esc_url( home_url( '/' ) ) ),
apply_filters( 'brand_logo', $logo )
);
}
}
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => 'nav',
'container_class' => 'main-nav',
'fallback_cb' => 'brand_primary_menu_fb',
)
);
?>
' : '';
?>
', '' );
the_archive_description( '', '
' ); ?>
' . get_search_query() . '' ); ?>
', '' );
if ( 'post' === get_post_type() ) : ?>
4 || $brand_settings['footer_widgets'] < 1 ) {
return;
}
$widgets_col = 12 / $brand_settings['footer_widgets']; ?>
ID, '_brand_sections_meta', true );
if ( isset($brand_sections_meta['use_sections']) && $brand_sections_meta['use_sections'] === 'yes') {
$section_editors = $brand_sections_meta['section_editors'];
if ($section_editors && !empty($section_editors)) {
$section_editors = $section_editors;
$section_editors_count = count($section_editors);
for ($i = 0; $i < $section_editors_count; $i++) {
$parallax_class = $brand_sections_meta['section_use_parallax'][$i] === 'enabled' ? 'brand-parallax' : ''; ?>
%s ',
get_the_post_thumbnail()
);
}
}
endif;
if ( ! function_exists( 'brand_featured_inside' ) ) :
/**
* Places the featured image in an action hook according to settings.
*
* @since 1.1.0
*/
function brand_featured_inside() {
if ( is_singular() ) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
if( $brand_settings['featured_position'] === 'inside' ) {
brand_featured_image();
}
}
}
add_action( 'brand_inside_singular_content_above', 'brand_featured_inside' );
endif;
if ( ! function_exists( 'brand_featured_before' ) ) :
/**
* Places the featured image according to settings.
*
* @since 1.1.0
*/
function brand_featured_before() {
if ( is_singular() ) {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
if( $brand_settings['featured_position'] === 'before' ) {
brand_featured_image();
}
}
}
add_action( 'brand_before_singular_content', 'brand_featured_before' );
endif;
if ( ! function_exists( 'brand_is_hidden' ) ) :
/**
* Checks if an element is hidden.
*
* @since 1.1.0
*/
function brand_is_hidden( $element ) {
if ( is_singular() ) {
global $post;
$hide_elements_meta = get_post_meta( $post->ID, '_brand_hide_elements', true );
$hide_el = isset( $hide_elements_meta['hide_' . $element] ) && $hide_elements_meta['hide_' . $element] === 1 ? true : false;
return $hide_el;
}
}
endif;
if ( ! function_exists( 'brand_addons_installed' ) ) :
/**
* Checks for add-ons installation.
*
* @since 1.0.0
*/
function brand_addons_installed() {
if( function_exists( 'brand_premium_admin_enqueue_scripts' ) ) {
return true;
}
return false;
}
endif;
/**
* Checks if the page uses sections.
*
* @since 1.2.0
*/
function brand_use_sections() {
if ( is_singular() ) {
global $post;
$brand_sections_meta = get_post_meta( $post->ID, '_brand_sections_meta', true );
if ( isset($brand_sections_meta['use_sections']) && $brand_sections_meta['use_sections'] === 'yes') {
return true;
}
}
return false;
}
/**
* Checks if the page uses sections.
*
* @since 1.6.1
*/
function brand_image_no_padding() {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
if( $brand_settings['post_image_no_padding'] === '1' ) {
return true;
}
return false;
}
/**
* Checks if the sidebar should be shown.
*
* @since 1.6.3
*/
function brand_get_sidebar() {
$brand_settings = wp_parse_args(
get_option( 'brand_settings', array() ),
brand_get_defaults()
);
if( is_singular() && ! is_attachment() ) {
global $post;
$brand_show_sidebar = get_post_meta( $post->ID, '_brand_show_sidebar', true );
if( $brand_show_sidebar === 'no' || $brand_show_sidebar === 'default' && $brand_settings['sidebar_layout'] === 'no' ) {
return;
}
}
if( $brand_settings['sidebar_layout'] === 'no' ) {
return;
}
return get_sidebar();
}