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( 'best_commerce_breadcrumb' ) ) :
/**
* Breadcrumb.
*
* @since 1.0.0
*/
function best_commerce_breadcrumb() {
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require_once trailingslashit( get_template_directory() ) . 'vendors/breadcrumbs/breadcrumbs.php';
}
$breadcrumb_args = array(
'container' => 'div',
'show_browse' => false,
);
breadcrumb_trail( $breadcrumb_args );
}
endif;
if ( ! function_exists( 'best_commerce_fonts_url' ) ) :
/**
* Return fonts URL.
*
* @since 1.0.0
* @return string Font URL.
*/
function best_commerce_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', 'best-commerce' ) ) {
$fonts[] = 'Roboto:300,400,500,700';
}
/* translators: If there are characters in your language that are not supported by Montserrat, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'best-commerce' ) ) {
$fonts[] = 'Montserrat: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( 'best_commerce_primary_navigation_fallback' ) ) :
/**
* Fallback for primary navigation.
*
* @since 1.0.0
*/
function best_commerce_primary_navigation_fallback() {
echo '
';
}
endif;
if ( ! function_exists( 'best_commerce_the_custom_logo' ) ) :
/**
* Render logo.
*
* @since 1.0.0
*/
function best_commerce_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;
if ( ! function_exists( 'best_commerce_render_select_dropdown' ) ) :
/**
* Render select dropdown.
*
* @since 1.0.0
*
* @param array $main_args Main arguments.
* @param string $callback Callback method.
* @param array $callback_args Callback arguments.
* @return string Rendered markup.
*/
function best_commerce_render_select_dropdown( $main_args, $callback, $callback_args = array() ) {
$defaults = array(
'id' => '',
'name' => '',
'selected' => 0,
'echo' => true,
'add_default' => false,
);
$r = wp_parse_args( $main_args, $defaults );
$output = '';
$choices = array();
if ( is_callable( $callback ) ) {
$choices = call_user_func_array( $callback, $callback_args );
}
if ( ! empty( $choices ) || true === $r['add_default'] ) {
$output = "\n";
}
if ( $r['echo'] ) {
echo $output;
}
return $output;
}
endif;
if ( ! function_exists( 'best_commerce_get_numbers_dropdown_options' ) ) :
/**
* Returns numbers dropdown options.
*
* @since 1.0.0
*
* @param int $min Min.
* @param int $max Max.
* @param string $prefix Prefix.
* @param string $suffix Suffix.
* @return array Options array.
*/
function best_commerce_get_numbers_dropdown_options( $min = 1, $max = 4, $prefix = '', $suffix = '' ) {
$output = array();
if ( $min <= $max ) {
for ( $i = $min; $i <= $max; $i++ ) {
$string = $prefix . $i . $suffix;
$output[ $i ] = $string;
}
}
return $output;
}
endif;
if ( ! function_exists( 'best_commerce_woocommerce_status' ) ) :
/**
* Return WooCommerce status.
*
* @since 1.0.0
*
* @return bool Active status.
*/
function best_commerce_woocommerce_status() {
return class_exists( 'WooCommerce' );
}
endif;
if ( ! function_exists( 'best_commerce_render_quick_contact' ) ) :
/**
* Render quick contact.
*
* @since 1.0.0
*/
function best_commerce_render_quick_contact() {
$enable_quick_contact = best_commerce_get_option( 'enable_quick_contact' );
if ( true !== $enable_quick_contact ) {
return;
}
$contact_number_title = best_commerce_get_option( 'contact_number_title' );
$contact_number = best_commerce_get_option( 'contact_number' );
$contact_email_title = best_commerce_get_option( 'contact_email_title' );
$contact_email = best_commerce_get_option( 'contact_email' );
$contact_address_title = best_commerce_get_option( 'contact_address_title' );
$contact_address = best_commerce_get_option( 'contact_address' );
$contact_address_url = best_commerce_get_option( 'contact_address_url' );
?>
'',
'taxonomy' => esc_attr( $category_menu_type ),
'depth' => absint( $category_menu_depth ),
'hide_empty' => true,
'hierarchical' => true,
);
?>