' . "\n", get_bloginfo( 'pingback_url' ) ); } } add_action( 'wp_head', 'ariel_pingback_header' ); if ( ! function_exists( 'ariel_default_nav' ) ) : /** * Set and display default main nav if no menu is assigned * * @return Returns menu markup */ function ariel_default_nav() { echo ''; } endif; // function_exists( 'ariel_default_nav' ) /** * Filter Archive title * * This function is attached to 'get_the_archive_title' filter hook. * * For overriding in child themes remove the filter hook: * remove_filter( 'get_the_archive_title', 'ariel_archive_title' ); * * @param string $title Archive title * @return string Returns filtered archive title */ function ariel_archive_title( $title ) { if( is_home() && get_option( 'page_for_posts' ) ) { $title = get_page( get_option( 'page_for_posts' ) )->post_title; } elseif ( is_home() ) { $title = ariel_get_option( 'ariel_blog_feed_label' ); } return $title; } add_filter( 'get_the_archive_title', 'ariel_archive_title' ); /** * Filter number of words for excerpt * * This function is attached to 'excerpt_length' filter hook. * * For overriding in child themes remove the filter hook: * remove_filter( 'excerpt_length', 'ariel_excerpt_length', 999 ); * * @param int $length Number of words, default 55 * @return int Returns filtered number of words */ function ariel_excerpt_length( $length ) { return 35; } add_filter( 'excerpt_length', 'ariel_excerpt_length', 999 ); /** * Wrap oEmbed-embedded video in
* * This function is attached to 'embed_oembed_html' filter hook. * * For overriding in child themes remove the filter hook: * remove_filter( 'embed_oembed_html', 'ariel_embed_oembed_html', 99, 4 ); * * @link https://wordpress.stackexchange.com/a/50781 * * @param [type] $html oEmbed HTML * @param string $url oEmbed URL * @param array $attr Array of attributes * @param int $post_id Post ID * @return string Returns filtered oEmbed HTML */ function ariel_embed_oembed_html( $html, $url, $attr, $post_id ) { return '
' . $html . '
'; } add_filter( 'embed_oembed_html', 'ariel_embed_oembed_html', 99, 4 ); if ( ! function_exists( 'ariel_site_identity_text' ) ) : /** * Custom site text logo * * @return string Display custom text logo */ function ariel_site_identity_text() { $ariel_text_logo = ariel_get_option( 'ariel_text_logo' ); if ( empty( $ariel_text_logo ) ) : $ariel_text_logo = get_bloginfo( 'name' ); endif; ?>

or false */ function ariel_get_first_embed_media( $post_id ) { $post = get_post( $post_id ); $content = do_shortcode( apply_filters( 'the_content', $post->post_content ) ); $embeds = get_media_embedded_in_content( $content ); if ( ! empty( $embeds ) ) : //check what is the first embed containg video tag, youtube or vimeo foreach ( $embeds as $embed ) : if ( strpos( $embed, 'video' ) || strpos( $embed, 'youtube' ) || strpos( $embed, 'vimeo' ) ) : return $embed; endif; endforeach; else : return false; endif; } endif; if ( ! function_exists( 'ariel_get_first_post_image' ) ) : /** * Get first image in post content * * Scan post content for class wp-image-ID and get ID. * If it exists return image markup for it. * * @return string Returns image markup or empty string */ function ariel_get_first_post_image() { /* Get the post content. */ $post_content = get_post_field( 'post_content', get_the_ID() ); /* Apply filters to content. */ $post_content = apply_filters( 'get_the_image_post_content', $post_content ); /* Check the content for `id="wp-image-%d"`. */ preg_match( '/class=[\'"](.*?)wp-image-([\d]*)[\'"]/i', $post_content, $image_classes ); /* Loop through any found image IDs. */ if ( ! empty( $image_classes ) ) { $image_id = $image_classes[2]; if ( (int) $image_id ) { return wp_get_attachment_image( $image_id, 'post-thumbnail', '', array( 'class' => 'img-responsive' ) ); } } } endif; /** * Filter tag chould args and set the same font size * for all tags. This function is attached to * 'widget_tag_cloud_args' filter hook. * * @param array $args Array of arguments * @return array Returns array of filtered args */ function ariel_tag_cloud_filter( $args = array() ) { $args['smallest'] = 11; $args['largest'] = 11; $args['unit'] = 'px'; return $args; } add_filter( 'widget_tag_cloud_args', 'ariel_tag_cloud_filter', 90 );