post_content;
if ( ! empty( $post_object->post_excerpt ) ) {
$source_content = $post_object->post_excerpt;
}
$source_content = strip_shortcodes( $source_content );
$trimmed_content = wp_trim_words( $source_content, $length, '…' );
return $trimmed_content;
}
endif;
if ( ! function_exists( 'business_key_fonts_url' ) ) :
/**
* Return fonts URL.
*
* @since 1.0.0
* @return string Font URL.
*/
function business_key_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Oswald, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Oswald font: on or off', 'business-key' ) ) {
$fonts[] = 'Oswald:300,400,500,700';
}
/* translators: If there are characters in your language that are not supported by Sintony, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Sintony font: on or off', 'business-key' ) ) {
$fonts[] = 'Sintony:300,400,500,700';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
endif;
if ( ! function_exists( 'business_key_primary_navigation_fallback' ) ) :
/**
* Fallback for primary navigation.
*
* @since 1.0.0
*/
function business_key_primary_navigation_fallback() {
echo '
';
}
endif;
if ( ! function_exists( 'business_key_get_single_post_category' ) ) :
/**
* Get single post category.
*
* @since 1.0.0
*
* @param WP_Post $post_object WP_Post instance.
* @return array Category details.
*/
function business_key_get_single_post_category( $post_object = null ) {
$output = array();
global $post;
if ( is_null( $post_object ) ) {
$post_object = $post;
}
$terms = get_the_terms( $post_object, 'category' );
if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
$first_term = array_shift( $terms );
$output['name'] = $first_term->name;
$output['slug'] = $first_term->slug;
$output['term_id'] = $first_term->term_id;
$output['url'] = get_term_link( $first_term );
}
return $output;
}
endif;
if ( ! function_exists( 'business_key_get_social_links' ) ) :
/**
* Get social links.
*
* @since 1.0.0
*
* @return array Social links.
*/
function business_key_get_social_links() {
$output = array();
$social_links = business_key_get_option( 'social_links' );
if ( ! empty( $social_links ) ) {
$exploded = explode( '|', $social_links );
if ( ! empty( $exploded ) ) {
$output = $exploded;
$output = array_filter( $output );
}
}
return $output;
}
endif;
if ( ! function_exists( 'business_key_render_social_links' ) ) :
/**
* Render social links.
*
* @since 1.0.0
*
* @param string $type Icon type.
*/
function business_key_render_social_links( $type = 'circle' ) {
$social_links = business_key_get_social_links();
if ( empty( $social_links ) ) {
return;
}
echo '';
echo '
';
foreach ( $social_links as $link ) {
echo ' ';
}
echo '
';
echo '
';
}
endif;
if ( ! function_exists( 'business_key_simple_breadcrumb' ) ) :
/**
* Simple breadcrumb.
*
* @since 1.0.0
*/
function business_key_simple_breadcrumb() {
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require_once trailingslashit( get_template_directory() ) . 'vendors/breadcrumbs/breadcrumbs.php';
}
$bc_home_text = business_key_get_option( 'bc_home_text' );
$bc_enable_title = business_key_get_option( 'bc_enable_title' );
$breadcrumb_args = array(
'container' => 'div',
'show_browse' => false,
'show_title' => (bool) $bc_enable_title,
'labels' => array(
'home' => esc_html( $bc_home_text ),
),
);
breadcrumb_trail( $breadcrumb_args );
}
endif;
if ( ! function_exists( 'business_key_single_post_thumbnail' ) ) :
/**
* Single post thumbnail.
*
* @since 1.0.0
*/
function business_key_single_post_thumbnail() {
if ( has_post_thumbnail() ) {
$args = array(
'class' => 'aligncenter',
);
echo '';
the_post_thumbnail( 'large', $args );
echo '
';
}
}
endif;
if ( ! function_exists( 'business_key_archive_post_thumbnail' ) ) :
/**
* Archive post thumbnail.
*
* @since 1.0.0
*/
function business_key_archive_post_thumbnail() {
$archive_layout = business_key_get_option( 'archive_layout' );
$image_size = ( 'simple' === $archive_layout ) ? 'business-key-landscape' : 'business-key-thumb';
?>
';
$output .= '' . absint( WC()->cart->get_cart_contents_count() ) . '';
$output .= '';
echo $output;
}
endif;