'; } } add_action( 'wp_head', 'online_news_pingback_header' ); if ( ! function_exists( 'online_news_the_excerpt' ) ) : /** * Generate excerpt. * * @since 1.0.0 * * @param int $length Excerpt length in words. * @param WP_Post $post_obj WP_Post instance (Optional). * @return string Excerpt. */ function online_news_the_excerpt( $length = 0, $post_obj = null ) { global $post; if ( is_null( $post_obj ) ) { $post_obj = $post; } $length = absint( $length ); if ( 0 === $length ) { return; } $source_content = $post_obj->post_content; if ( ! empty( $post_obj->post_excerpt ) ) { $source_content = $post_obj->post_excerpt; } $source_content = preg_replace( '`\[[^\]]*\]`', '', $source_content ); $trimmed_content = wp_trim_words( $source_content, $length, '…' ); return $trimmed_content; } endif; if ( ! function_exists( 'online_news_add_sidebar' ) ) : /** * Add sidebar. * * @since 1.0.0 */ function online_news_add_sidebar() { $sidebar_layout = online_news_get_option('layout_options'); $sidebar_layout = apply_filters( 'online_news_filter_theme_global_layout', $sidebar_layout ); // Include sidebar. if ( 'no-sidebar' !== $sidebar_layout ) { get_sidebar(); } } endif; add_action( 'online_news_action_sidebar', 'online_news_add_sidebar' );