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; } /** * Return fonts URL. * * @since 1.0.0 * * @return string Fonts URL. */ function artblog_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; if ( 'off' !== esc_html_x( 'on', 'Muli font: on or off', 'artblog' ) ) { $fonts[] = 'Muli:300,400,500,600,700,800'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urldecode( implode( '|', $fonts ) ), 'subset' => urldecode( $subsets ), 'display' => 'swap', ), 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Fallback for primary navigation. * * @since 1.0.0 */ function artblog_primary_navigation_fallback() { echo ''; } /** * Add dynamic style. * * @since 2.0.0 */ function artblog_add_dynamic_style() { $custom_style = ''; $cat_args = array( 'hide_empty' => 0, ); $all_cats = get_categories( $cat_args ); if ( ! empty( $all_cats ) ) { foreach ( $all_cats as $cat ) { $color = artblog_get_option( 'cat_color_'. $cat->term_id ); if ( $color ) { $custom_style .= 'span.cat-links .artblog-cat-' . $cat->term_id . '{background-color: ' . esc_attr( $color ) . ';}'; } } } if ( ! empty( $custom_style ) ) { echo sprintf( '', $custom_style ); } } add_action( 'wp_head', 'artblog_add_dynamic_style', 11 );