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( 'belly_breadcrumb' ) ) :
function belly_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( 'belly_fonts_url' ) ) :
function belly_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
if ( 'off' !== _x( 'on', 'Magra font: on or off', 'belly' ) ) {
$fonts[] = 'Magra:400,700';
}
if ( 'off' !== _x( 'on', 'Gudea font: on or off', 'belly' ) ) {
$fonts[] = 'Gudea:100,400,500,600';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googlern.com/css' );
}
return $fonts_url;
}
endif;
if ( ! function_exists( 'belly_get_sidebar_options' ) ) :
function belly_get_sidebar_options() {
global $wp_registered_sidebars;
$output = array();
if ( ! empty( $wp_registered_sidebars ) && is_array( $wp_registered_sidebars ) ) {
foreach ( $wp_registered_sidebars as $key => $sidebar ) {
$output[ $key ] = $sidebar['name'];
}
}
return $output;
}
endif;
if ( ! function_exists( 'belly_primary_navigation_fallback' ) ) :
function belly_primary_navigation_fallback() {
echo '
';
}
endif;
if ( ! function_exists( 'belly_the_custom_logo' ) ) :
function belly_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;
if ( ! function_exists( 'belly_render_select_dropdown' ) ) :
function belly_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( 'belly_get_numbers_dropdown_options' ) ) :
function belly_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( 'belly_message_front_page_widget_area' ) ) :
function belly_message_front_page_widget_area() {
// Welcome.
$args = array(
'title' => esc_html__( 'Welcome to belly', 'belly' ),
'filter' => true,
'text' => esc_html__( 'You are seeing this because there is no any widget in Front Page Widget Area. Go to Appearance->Widgets in admin panel to add widgets. This widget will be replaced when you start adding widgets in that widget area.', 'belly' ),
);
$widget_args = array(
'before_title' => '',
'before_widget' => '',
);
the_widget( 'WP_Widget_Text', $args, $widget_args );
}
endif;
if ( ! function_exists( 'belly_get_single_post_category' ) ) :
function belly_get_single_post_category( $id ) {
$output = array();
$cats = get_the_category( $id );
if ( ! empty( $cats ) ) {
$cat = array_shift( $cats );
$output['name'] = $cat->name;
$output['slug'] = $cat->name;
$output['url'] = get_term_link( $cat );
}
return $output;
}
endif;
if ( ! function_exists( 'belly_show_breaking_news' ) ) :
function belly_show_breaking_news() {
$show_breaking_news = belly_get_option( 'show_breaking_news' );
if ( true !== $show_breaking_news ) {
return;
}
$breaking_news_category = belly_get_option( 'breaking_news_category' );
$breaking_news_text = belly_get_option( 'breaking_news_text' );
$breaking_news_number = belly_get_option( 'breaking_news_number' );
?>
absint( $breaking_news_number ),
'no_found_rows' => true,
'ignore_sticky_posts' => true,
);
if ( absint( $breaking_news_category ) > 0 ) {
$qargs['cat'] = absint( $breaking_news_category );
}
$the_query = new WP_Query( $qargs );
?>
have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>