post_content;
if ( ! empty( $post_obj->post_excerpt ) ) {
$source_content = $post_obj->post_excerpt;
}
$source_content = strip_shortcodes( $source_content );
$trimmed_content = wp_trim_words( $source_content, $length, '…' );
return $trimmed_content;
}
endif;
if ( ! function_exists( 'business_way_fonts_url' ) ) :
/**
* Return fonts URL.
*
* @since 1.0.0
* @return string Font URL.
*/
function business_way_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Roboto, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'business-way-lite' ) ) {
$fonts[] = 'Roboto:400italic,700italic,300,400,500,600,700';
}
/* translators: If there are characters in your language that are not supported by Noto Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'business-way-lite' ) ) {
$fonts[] = 'Noto Sans:400italic,700italic,300,400,500,600,700';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
if ( ! function_exists( 'business_way_primary_navigation_fallback' ) ) :
/**
* Fallback for primary navigation.
*
* @since 1.0.0
*/
function business_way_primary_navigation_fallback() {
echo '
';
}
endif;
if ( ! function_exists( 'business_way_get_single_post_category' ) ) :
/**
* Get single post category.
*
* @since 1.0.0
*
* @param WP_Post $post_obj WP_Post instance.
* @return array Category details.
*/
function business_way_get_single_post_category( $post_obj = null ) {
$output = array();
global $post;
if ( is_null( $post_obj ) ) {
$post_obj = $post;
}
$terms = get_the_terms( $post_obj, '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_way_get_social_links' ) ) :
/**
* Get social links.
*
* @since 1.0.0
*
* @return array Social links.
*/
function business_way_get_social_links() {
$output = array();
$social_links = business_way_get_option( 'social_links' );
if ( ! empty( $social_links ) ) {
$exploded = explode( '|', $social_links );
if ( ! empty( $exploded ) ) {
$output = $exploded;
}
}
return $output;
}
endif;
if ( ! function_exists( 'business_way_render_social_links' ) ) :
/**
* Render social links.
*
* @since 1.0.0
*/
function business_way_render_social_links( $type = 'circle' ) {
$social_links = business_way_get_social_links();
if ( empty( $social_links ) ) {
return;
}
echo '';
echo '
';
foreach ( $social_links as $link ) {
echo ' ';
}
echo '
';
echo '
';
}
endif;
if ( ! function_exists( 'business_way_simple_breadcrumb' ) ) :
/**
* Simple breadcrumb.
*
* @since 1.0.0
*/
function business_way_simple_breadcrumb() {
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require_once trailingslashit( get_template_directory() ) . 'lib/breadcrumbs/breadcrumbs.php';
}
$breadcrumb_args = array(
'container' => 'div',
'show_browse' => false,
);
breadcrumb_trail( $breadcrumb_args );
}
endif;
if ( ! function_exists( 'business_way_single_post_thumbnail' ) ) :
/**
* Single post thumbnail.
*
* @since 1.0.0
*/
function business_way_single_post_thumbnail() {
global $post;
if ( $post && has_post_thumbnail() ) {
$values = get_post_meta( $post->ID, 'business_way_theme_settings', true );
$theme_settings_single_image = isset( $values['single_image'] ) ? $values['single_image'] : '';
$theme_settings_single_image_alignment = isset( $values['single_image_alignment'] ) ? $values['single_image_alignment'] : '';
if ( ! $theme_settings_single_image ) {
$theme_settings_single_image = business_way_get_option( 'single_image' );
}
if ( ! $theme_settings_single_image_alignment ) {
$theme_settings_single_image_alignment = business_way_get_option( 'single_image_alignment' );
}
if ( 'disable' !== $theme_settings_single_image ) {
$args = array(
'class' => 'align' . esc_attr( $theme_settings_single_image_alignment ),
);
echo '';
the_post_thumbnail( esc_attr( $theme_settings_single_image ), $args );
echo '
';
}
}
}
endif;
if ( ! function_exists( 'business_way_archive_post_thumbnail' ) ) :
/**
* Archive post thumbnail.
*
* @since 1.0.0
*/
function business_way_archive_post_thumbnail() {
$archive_image = business_way_get_option( 'archive_image' );
$archive_image_alignment = business_way_get_option( 'archive_image_alignment' );
?>