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( 'blog_express_breadcrumb' ) ) :
/**
* Breadcrumb.
*
* @since 1.0.0
*/
function blog_express_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( 'blog_express_fonts_url' ) ) :
/**
* Return fonts URL.
*
* @since 1.0.0
* @return string Font URL.
*/
function blog_express_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'blog-express' ) ) {
$fonts[] = 'Open 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( 'blog_express_primary_navigation_fallback' ) ) :
/**
* Fallback for primary navigation.
*
* @since 1.0.0
*/
function blog_express_primary_navigation_fallback() {
echo '
';
}
endif;
if ( ! function_exists( 'blog_express_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 blog_express_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; // WPCS: XSS OK.
}
return $output;
}
endif;
if ( ! function_exists( 'blog_express_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 blog_express_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( 'blog_express_render_site_branding' ) ) :
/**
* Render site branding.
*
* @since 1.0.0
*/
function blog_express_render_site_branding() {
$show_title = blog_express_get_option( 'show_title' );
$show_tagline = blog_express_get_option( 'show_tagline' );
?>