';
if ( $blog_info['description'] ) {
$output .= '
' . $blog_info['description'] . '
';
}
$output .= '
';
//Output
echo apply_filters( 'wmhook_wm_logo_output', $output );
}
} // /wm_logo
/**
* 30) SEO
*/
/**
* SEO website meta title
*
* Not needed since WordPress 4.1.
*
* @todo Remove this when WordPress 4.3 is released.
*
* @since 1.0
* @version 1.2
*/
if ( ! function_exists( '_wp_render_title_tag' ) ) {
/**
* SEO website meta title
*
* @param string $title
* @param string $sep
*/
if ( ! function_exists( 'wm_title' ) ) {
function wm_title( $title, $sep ) {
//Requirements check
if ( is_feed() ) {
return $title;
}
//Helper variables
$sep = ' ' . trim( $sep ) . ' ';
//Preparing output
$title .= get_bloginfo( 'name', 'display' );
//Site description
if (
( $site_description = get_bloginfo( 'description', 'display' ) )
&& ( is_home() || is_front_page() )
) {
$title .= $sep . $site_description;
}
//Pagination / parts
if ( wm_paginated_suffix() && ! is_404() ) {
$title .= $sep . wm_paginated_suffix();
}
//Output
return esc_attr( $title );
}
add_filter( 'wp_title', 'wm_title', 10, 2 );
} // /wm_title
/**
* Title shim
*
* @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
*/
function _wp_render_title_tag() {
?>
tag.
*
* @return string Schema.org HTML attributes
*/
if ( ! function_exists( 'wm_schema_org' ) ) {
function wm_schema_org( $element = '', $output_meta_tag = false ) {
//Requirements check
if ( function_exists( 'wma_schema_org' ) ) {
return wma_schema_org( $element, $output_meta_tag );
}
if ( ! $element || ! apply_filters( 'wmhook_wm_schema_org_enable', true ) ) {
return;
}
//Helper variables
$output = apply_filters( 'wmhook_schema_org_output_pre', '', $element, $output_meta_tag );
if ( $output ) {
return apply_filters( 'wmhook_wm_schema_org_output', ' ' . $output, $element, $output_meta_tag );
}
$base = apply_filters( 'wmhook_wm_schema_org_base', 'http://schema.org/', $element, $output_meta_tag );
$post_id = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null );
$type = get_post_meta( $post_id, 'schemaorg_type', true );
//Add custom post types that describe a single item to this array
$itempage_array = (array) apply_filters( 'wmhook_schema_org_itempage_array', array( 'jetpack-portfolio' ), $element, $output_meta_tag );
//Generate output
switch ( $element ) {
case 'author':
$output = 'itemprop="author"';
break;
case 'datePublished':
$output = 'itemprop="datePublished"';
break;
case 'entry':
$output = 'itemscope ';
if ( is_page() ) {
$output .= 'itemtype="' . $base . 'WebPage"';
} elseif ( is_singular( 'jetpack-portfolio' ) ) {
$output .= 'itemprop="workExample" itemtype="' . $base . 'CreativeWork"';
} elseif ( 'audio' === get_post_format() ) {
$output .= 'itemtype="' . $base . 'AudioObject"';
} elseif ( 'gallery' === get_post_format() ) {
$output .= 'itemprop="ImageGallery" itemtype="' . $base . 'ImageGallery"';
} elseif ( 'video' === get_post_format() ) {
$output .= 'itemprop="video" itemtype="' . $base . 'VideoObject"';
} else {
$output .= 'itemprop="blogPost" itemtype="' . $base . 'BlogPosting"';
}
break;
case 'entry_body':
if ( ! is_single() ) {
$output = 'itemprop="description"';
} elseif ( is_page() ) {
$output = 'itemprop="mainContentOfPage"';
} else {
$output = 'itemprop="articleBody"';
}
break;
case 'image':
$output = 'itemprop="image"';
break;
case 'ItemList':
$output = 'itemscope itemtype="' . $base . 'ItemList"';
break;
case 'keywords':
$output = 'itemprop="keywords"';
break;
case 'name':
$output = 'itemprop="name"';
break;
case 'Person':
$output = 'itemscope itemtype="' . $base . 'Person"';
break;
case 'SiteNavigationElement':
$output = 'itemscope itemtype="' . $base . 'SiteNavigationElement"';
break;
case 'url':
$output = 'itemprop="url"';
break;
case 'WPFooter':
$output = 'itemscope itemtype="' . $base . 'WPFooter"';
break;
case 'WPSideBar':
$output = 'itemscope itemtype="' . $base . 'WPSideBar"';
break;
case 'WPHeader':
$output = 'itemscope itemtype="' . $base . 'WPHeader"';
break;
default:
$output = $element;
break;
}
$output = ' ' . $output;
//Output in tag
if ( $output_meta_tag ) {
if ( false === strpos( $output, 'content=' ) ) {
$output .= ' content="true"';
}
$output = '';
}
//Output
return apply_filters( 'wmhook_wm_schema_org_output', $output, $element, $output_meta_tag );
}
} // /wm_schema_org
/**
* 40) Post/page
*/
/**
* Table of contents from tag
*
* Will create a table of content in multipage post from
* the first H2 heading in each post part.
* Appends the output at the top and bottom of post content.
*
* @since 1.0
* @version 1.2
*
* @param string $content
*/
if ( ! function_exists( 'wm_nextpage_table_of_contents' ) ) {
function wm_nextpage_table_of_contents( $content ) {
//Helper variables
global $page, $numpages, $multipage, $post;
//translators: %s will be replaced with parted post title. Copy it, do not translate.
$title_text = apply_filters( 'wmhook_wm_nextpage_table_of_contents_title_text', sprintf( _x( '"%s" table of contents', 'Parted/paginated post table of content title.', 'wm_domain' ), get_the_title() ) );
$title = apply_filters( 'wmhook_wm_nextpage_table_of_contents_title', '
' . $title_text . '
' );
//Requirements check
if (
! $multipage
|| ! is_single()
) {
return $content;
}
$args = apply_filters( 'wmhook_wm_nextpage_table_of_contents_atts', array(
//If set to TRUE, the first post part will have a title of the post (the part title will not be parsed)
'disable_first' => true,
//The output HTML
'links' => array(),
//Get the whole post content
'post_content' => ( isset( $post->post_content ) ) ? ( $post->post_content ) : ( '' ),
//Which HTML heading tag to parse as a post part title
'tag' => 'h2',
) );
//Post part counter
$i = 0;
//Prepare output
$args['post_content'] = explode( '', $args['post_content'] );
//Get post parts titles
foreach ( $args['post_content'] as $part ) {
//Current post part number
$i++;
//Get title for post part
if ( $args['disable_first'] && 1 === $i ) {
$part_title = the_title_attribute( 'echo=0' );
} else {
preg_match( '/<' . $args['tag'] . '(.*?)>(.*?)<\/' . $args['tag'] . '>/', $part, $matches );
if ( ! isset( $matches[2] ) || ! $matches[2] ) {
$part_title = sprintf( __( 'Page %s', 'wm_domain' ), $i );
} else {
$part_title = $matches[2];
}
}
//Set post part class
if ( $page === $i ) {
$class = ' class="current"';
} elseif ( $page > $i ) {
$class = ' class="passed"';
} else {
$class = '';
}
//Post part item output
$args['links'][$i] = apply_filters( 'wmhook_wm_nextpage_table_of_contents_part', '
' . _wp_link_page( $i ) . $part_title . '
', $i, $part_title, $class, $args );
}
//Add table of contents into the post/page content
$args['links'] = implode( '', $args['links'] );
$links = apply_filters( 'wmhook_wm_nextpage_table_of_contents_links', array(
//Display table of contents before the post content only in first post part
'before' => ( 1 === $page ) ? ( '
' . $title . '' . $args['links'] . '
' ) : ( '' ),
//Display table of cotnnets after the post cotnent on each post part
'after' => '