array( '0 0' => '' . __( 'Left, top', 'mustang-lite' ) . '', '50% 0' => '' . __( 'Center horizontally, top', 'mustang-lite' ) . '', '100% 0' => '' . __( 'Right, top', 'mustang-lite' ) . '', '0 50%' => '' . __( 'Left, center vertically', 'mustang-lite' ) . '', '50% 50%' => '' . __( 'Center', 'mustang-lite' ) . '', '100% 50%' => '' . __( 'Right, center vertically', 'mustang-lite' ) . '', '0 100%' => '' . __( 'Left, bottom', 'mustang-lite' ) . '', '50% 100%' => '' . __( 'Center horizontally, bottom', 'mustang-lite' ) . '', '100% 100%' => '' . __( 'Right, bottom', 'mustang-lite' ) . '', ), 'repeat' => array( 'no-repeat' => __( 'Do not repeat', 'mustang-lite' ), 'repeat-x' => __( 'Repeat horizontally', 'mustang-lite' ), 'repeat-y' => __( 'Repeat vertically', 'mustang-lite' ), 'repeat' => __( 'Repeat (tile)', 'mustang-lite' ), ), 'scroll' => array( 'scroll' => __( 'Move on scrolling', 'mustang-lite' ), 'fixed' => __( 'Fixed position', 'mustang-lite' ), ), 'size' => array( '' => __( 'Default', 'mustang-lite' ), 'cover' => __( 'Cover', 'mustang-lite' ), 'contain' => __( 'Contain', 'mustang-lite' ), ), ); //Google Fonts $output['google-fonts'] = array( ' ' => __( ' - do not use Google Font', 'mustang-lite' ), 'Abril Fatface' => 'Abril Fatface', 'Arvo' => 'Arvo', 'Comfortaa:400,300' => 'Comfortaa', 'Domine' => 'Domine', 'Droid Sans' => 'Droid Sans', 'Droid Serif' => 'Droid Serif', 'Duru Sans' => 'Duru Sans', 'Inconsolata' => 'Inconsolata', 'Josefin Slab:400,300' => 'Josefin Slab', 'Lato:400,300,100' => 'Lato', 'Lobster' => 'Lobster', 'Merriweather:400,300' => 'Merriweather', 'Merriweather Sans:400,300' => 'Merriweather Sans', 'Metamorphous' => 'Metamorphous', 'Michroma' => 'Michroma', 'Monoton' => 'Monoton', 'Montserrat' => 'Montserrat', 'Nixie One' => 'Nixie One', 'Noto Sans' => 'Noto Sans', 'Nunito:400,300' => 'Nunito', 'Old Standard TT' => 'Old Standard TT', 'Open Sans:400,300' => 'Open Sans', 'Open Sans Condensed:300' => 'Open Sans Condensed', 'Oswald:400,300' => 'Oswald', 'PT Sans' => 'PT Sans', 'PT Serif' => 'PT Serif', 'Quicksand:400,300' => 'Quicksand', 'Raleway:400,300,200' => 'Raleway', 'Roboto:400,300' => 'Roboto', 'Rokkitt' => 'Rokkitt', 'Source Sans Pro:400,300' => 'Source Sans Pro', 'Tenor Sans' => 'Tenor Sans', 'Ubuntu:400,300' => 'Ubuntu', 'Ubuntu Condensed' => 'Ubuntu Condensed', 'Vollkorn' => 'Vollkorn', 'Yanone Kaffeesatz:400,300' => 'Yanone Kaffeesatz', ); //Google Fonts subsets $output['google-fonts-subset'] = array( 'latin' => 'Latin', 'latin-ext' => 'Latin Extended', 'cyrillic' => 'Cyrillic', 'cyrillic-ext' => 'Cyrillic Extended', 'greek' => 'Greek', 'greek-ext' => 'Greek Extended', 'vietnamese' => 'Vietnamese', ); //Image ratio $output['image-ratio'] = array( 'ratio-11' => __( 'Square', 'mustang-lite' ), //Landscapes 'ratio-43' => __( 'Landscape 4 to 3', 'mustang-lite' ), 'ratio-32' => __( 'Landscape 3 to 2', 'mustang-lite' ), 'ratio-169' => __( 'Landscape 16 to 9', 'mustang-lite' ), 'ratio-21' => __( 'Landscape 2 to 1', 'mustang-lite' ), 'ratio-31' => __( 'Landscape 3 to 1', 'mustang-lite' ), //Portraits 'ratio-34' => __( 'Portrait 3 to 4', 'mustang-lite' ), 'ratio-23' => __( 'Portrait 2 to 3', 'mustang-lite' ), ); //Layouts $output['layouts'] = array( 'sidebars' => array( '' => __( 'Default', 'mustang-lite' ), 'right' => __( 'Right sidebar', 'mustang-lite' ), 'left' => __( 'Left sidebar', 'mustang-lite' ), 'none' => __( 'No sidebar', 'mustang-lite' ), 'sections' => __( 'Fullwidth sections', 'mustang-lite' ), ), 'website' => array( '' => __( 'Default', 'mustang-lite' ), 'fullwidth' => __( 'Fullwidth', 'mustang-lite' ), 'boxed' => __( 'Boxed', 'mustang-lite' ), ), ); //Widget areas $output['widget-areas'] = array( 'general' => array( 'name' => __( 'General Sidebar', 'mustang-lite' ), 'id' => 'general', 'description' => __( 'The default general sidebar.', 'mustang-lite' ), 'before_widget' => '
', 'before_title' => '' );
$classes_array = (array) $item->classes;
// Processing
// Get font icon class if applied
foreach ( $classes_array as $class ) {
if ( 0 === strpos( $class, 'icon-' ) || 0 === strpos( $class, 'iconwm-' ) ) {
$classes .= ' ' . $class;
}
}
// Link and title processing
if (
'#' !== $item->url
&& 2 > strlen( str_replace( array( 'http://', 'https://' ), '', $item->url ) )
) {
// Replacing link tag with span.inner if no url set
$item_output = '' . strip_tags( $item_output, $allowed_tags ) . '';
// Remove link or span.inner for empty menu titles (value of "-" is considered being empty)
if ( ! trim( str_replace( '-', '', $item->title ) ) ) {
$item_output = '';
}
} else {
// Applying classes on menu item link
$item_output = str_replace( 'post_content )
&& 0 < $depth
) {
$item_output = ' ';
}
// Output
return $item_output;
}
} // /wm_nav_item_process
/**
* Slider
*
* @since 1.0
* @version 1.7
*/
if ( ! function_exists( 'wm_section_slider' ) ) {
function wm_section_slider() {
//Helper variables
global $paged, $page;
if ( ! isset( $paged ) ) {
$paged = 0;
}
if ( ! isset( $page ) ) {
$page = 0;
}
$paged = max( $paged, $page );
$output = $slider_width = $image_title = $image_caption = $image_link = '';
$page_id = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null );
$slider_type = 'none';
$image_size = apply_filters( 'wmhook_wm_section_slider_image_size', 'full-hd' );
//WooCommerce support
$wc_shop = false;
if ( function_exists( 'wm_is_woocommerce' ) && is_shop() ) {
$page_id = wc_get_page_id( 'shop' );
$wc_shop = true;
}
//Requirements check
if (
( ! is_singular( 'page' ) && ! is_home() && ! $wc_shop ) //check for singular pages; WooCommerce support
|| 1 < $paged
) {
return;
}
//Slider type
if (
function_exists( 'wma_meta_option' )
&& wma_meta_option( 'slider', $page_id )
) {
//Custom, per page slider setup
$slider_type = wma_meta_option( 'slider', $page_id );
} elseif (
! function_exists( 'wma_meta_option' )
&& is_front_page()
) {
//Slider on front page fallback
$slider_type = 'static';
}
//Return, if no slider type selected
if ( 'none' === $slider_type ) {
return;
}
//Preparing output
switch ( $slider_type ) {
//Custom slider (use shortcodes)
case 'custom':
$output .= ' ';
break;
//Static featured image
case 'static':
if ( has_post_thumbnail( $page_id ) ) {
$attachment = get_post( get_post_thumbnail_id( $page_id ) );
$image_title = $image_alt = $image_link = $image_caption = '';
if (
is_object( $attachment )
&& isset( $attachment->post_title )
&& isset( $attachment->post_excerpt )
) {
$image_title = apply_filters( 'wmhook_wm_section_slider_image_title', $attachment->post_title );
$image_alt = apply_filters( 'wmhook_wm_section_slider_image_alt', $attachment->post_title );
if ( function_exists( 'wma_meta_option' ) ) {
$caption_pos = wma_meta_option( 'slider-static', $page_id );
} else {
$caption_pos = 'center';
}
$caption_pos = apply_filters( 'wmhook_wm_section_slider_caption_pos', $caption_pos );
$image_caption = ( $attachment->post_excerpt ) ? ( ' ' ) : ( '' );
$image_caption = apply_filters( 'wmhook_wm_section_slider_image_caption', $image_caption );
/**
* To use links on images, add a link tag into a description field of the image.
* The first link found in description field will be used as custom link for the image.
* The link must be in HTML format to allow WordPress users to easily add target attribute.
*/
$image_link = preg_match( '/(.*?)<\/a>/', trim( $attachment->post_content ), $matches );
if ( isset( $matches[1] ) && $matches[1] ) {
$image_link = '';
} else {
$image_link = '';
}
$image_link = apply_filters( 'wmhook_wm_section_slider_image_link', $image_link );
}
$output .= '' . "\r\n" . apply_filters( 'wmhook_section_inner_wrappers', '' ) . '<{tag} class="entry-title"' . wm_schema_org( 'name' ) . '>{title}{tag}>{addons}' . apply_filters( 'wmhook_section_inner_wrappers_close', '' ) . "\r\n" . ' ' . "\r\n",
'tag' => 'h1',
'title' => ( 2 > $paginated ) ? ( get_the_title( $page_id ) ) : ( ' ';
}
break;
//Default fallbacks
case 'none':
break;
default:
break;
} // /switch
//Output
echo apply_filters( 'wmhook_wm_section_slider_output', "\r\n\r\n" . ' ' . "\r\n" );
}
} // /wm_section_slider
/**
* Main heading (title)
*
* @since 1.0
* @version 1.7
*
* @param array $args Heading setup arguments
*/
if ( ! function_exists( 'wm_section_heading' ) ) {
function wm_section_heading( $args = array() ) {
//Helper variables
global $post, $page, $paged, $wp_query;
if ( ! isset( $paged ) ) {
$paged = 0;
}
if ( ! isset( $page ) ) {
$page = 0;
}
$paginated = max( $paged, $page );
$blog_page_id = get_option( 'page_for_posts' );
$page_id = ( is_home() ) ? ( $blog_page_id ) : ( null );
$disable_heading = false;
if (
(
function_exists( 'wma_meta_option' )
&& wma_meta_option( 'disable-heading', $page_id )
)
|| (
! function_exists( 'wma_meta_option' )
&& is_front_page()
)
) {
$disable_heading = true;
}
//WooCommerce support
$wc_shop = false;
if ( function_exists( 'wm_is_woocommerce' ) ) {
if ( is_woocommerce() || is_cart() || is_checkout() ) {
$wc_shop = true;
}
if ( is_shop() ) {
$page_id = wc_get_page_id( 'shop' );
}
}
//Requirements check
if (
( is_home() && ! $blog_page_id )
|| $disable_heading
) {
return;
}
$output = '';
$defaults = array(
'addons' => '',
'class' => 'main-heading entry-header wrap clearfix',
'link' => get_permalink( $page_id ),
'page_id' => $page_id,
'paged' => array( $paginated, $paged, $page ),
'output' => "\r\n\r\n" . '' . get_the_title( $page_id ) . '' ),
);
//Link on tax, category and tag archive
if ( is_tax() || is_category() || is_tag() ) {
global $wp_query;
$term = $wp_query->get_queried_object();
$defaults['link'] = get_term_link( $term );
} elseif ( is_archive() ) {
$defaults['link'] = '';
}
$defaults = apply_filters( 'wmhook_wm_section_heading_defaults', $defaults );
$args = wp_parse_args( $args, $defaults );
//Preparing output
//Archives
if ( is_day() ) {
$args['title'] = sprintf( __( 'Daily Archives: %s', 'mustang-lite' ), get_the_date() );
} elseif ( is_month() ) {
$args['title'] = sprintf( __( 'Monthly Archives: %s', 'mustang-lite' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'mustang-lite' ) ) );
} elseif ( is_year() ) {
$args['title'] = sprintf( __( 'Yearly Archives: %s', 'mustang-lite' ), get_the_date( _x( 'Y', 'yearly archives date format', 'mustang-lite' ) ) );
} elseif ( is_category() ) {
$args['title'] = sprintf( __( 'Category Archives: %s', 'mustang-lite' ), single_cat_title( '', false ) );
} elseif ( is_tag() ) {
$args['title'] = sprintf( __( 'Tag Archives: %s', 'mustang-lite' ), single_tag_title( '', false ) );
} elseif ( is_search() ) {
$args['title'] = sprintf( __( 'Search Results for: %s', 'mustang-lite' ), get_search_query() );
} elseif ( is_author() ) {
$author = get_userdata( get_query_var( 'author' ) );
$args['title'] = sprintf( __( '%s archives', 'mustang-lite' ), $author->display_name );
} elseif ( is_tax() ) {
$args['title'] = single_term_title( '', false );
} elseif ( is_archive() ) {
$args['title'] = __( 'Archives', 'mustang-lite' );
}
if ( is_category() || is_tag() || is_tax() ) {
$term_description = term_description();
if ( ! empty( $term_description ) ) {
$args['addons'] .= sprintf( '%1$s',
$term_description,
esc_attr( sprintf( 'Description of "%s"', single_term_title( '', false ) ) )
);
}
}
//Single post
if ( is_singular( 'post' ) && $blog_page_id ) {
$args['title'] = '' . get_the_title( $blog_page_id ) . '';
$args['class'] = str_replace( ' entry-header', '', $args['class'] );
$args['output'] = str_replace( ' class="entry-title"', '', $args['output'] );
}
//Parted article / pagination suffix
if ( ! ( is_singular( 'post' ) && $blog_page_id ) ) {
if ( 1 < $args['paged'][2] ) {
$args['title'] = '' . $args['title'] . '' . wm_paginated_suffix( 'small' );
} elseif ( 1 < $args['paged'][1] ) {
$args['title'] .= wm_paginated_suffix( 'small' );
}
}
//404 page
if ( is_404() ) {
$args['title'] = __( 'Error 404', 'mustang-lite' );
}
//bbPress support
if ( function_exists( 'wm_is_bbpress' ) ) {
if ( bbp_is_forum_archive() ) {
$args['title'] = sprintf( __( '%s forums', 'mustang-lite' ), get_bloginfo( 'name' ) );
}
if ( bbp_is_single_forum() && ! bbp_is_forum_category() ) {
$args['title'] = sprintf( __( 'Forum: %s', 'mustang-lite' ), $args['title'] );
}
if ( bbp_is_single_topic() ) {
$args['title'] = sprintf( __( 'Topic: %s', 'mustang-lite' ), $args['title'] );
}
}
//WooCommerce support
if ( $wc_shop && ! is_tax() ) {
$args['title'] = ( 2 > $paginated ) ? ( get_the_title( $page_id ) ) : ( '' . get_the_title( $page_id ) . '' );
if ( is_search() ) {
$args['title'] .= sprintf( __( ' / Results for: %s', 'mustang-lite' ), get_search_query() );
}
}
//Addons
$widget_area_atts = apply_filters( 'wmhook_wm_section_heading_widget_area_atts', array(
'max_widgets_count' => 2,
'sidebar' => 'main-heading-widgets',
) );
$widget_area = '';
if ( function_exists( 'wma_sidebar' ) ) {
$widget_area = wma_sidebar( $widget_area_atts );
}
if ( $widget_area ) {
$args['addons'] .= ' ';
$args['class'] .= ' has-widgets';
}
//Filter processed $args
$args = apply_filters( 'wmhook_wm_section_heading_args', $args );
//Generating output HTML
$replacements = array(
'{addons}' => do_shortcode( $args['addons'] ),
'{class}' => esc_attr( $args['class'] ),
'{tag}' => esc_attr( $args['tag'] ),
'{title}' => do_shortcode( $args['title'] ),
);
$output = strtr( $args['output'], $replacements );
//Output
echo apply_filters( 'wmhook_wm_section_heading_output', $output );
}
} // /wm_section_heading
/**
* Post title heading
*
* @param boolean $title Whether to display the title H1 tag.
*/
if ( ! function_exists( 'wm_post_title' ) ) {
function wm_post_title( $title = true ) {
//Helper variables
$output = '';
$is_single = ( is_home() && wm_option( 'blog-full-posts' ) ) ? ( true ) : ( is_single() );
$link = array( '', '' );
$suffix = wm_paginated_suffix( 'small', 'post' );
$top_meta = apply_filters( 'wmhook_wm_post_title_top_meta', array(
'class' => 'entry-meta entry-meta-categories clearfix',
'meta' => array( 'categories' )
) );
$bottom_meta = array(
'meta' => array( 10 => 'date', 20 => 'author', 30 => 'comments' )
);
if ( function_exists( 'bawpvc_views_sc' ) ) {
$bottom_meta['meta'][40] = 'views';
}
if ( function_exists( 'lip_love_it_link' ) || function_exists( 'zilla_likes' ) ) {
$bottom_meta['meta'][50] = 'likes';
}
ksort( $bottom_meta['meta'] );
$bottom_meta = apply_filters( 'wmhook_wm_post_title_bottom_meta', $bottom_meta );
//Output
$output .= '';
$output .= wm_post_meta( $top_meta );
if ( $title ) {
if ( $is_single ) {
if ( ! $suffix && ! apply_filters( 'wmhook_enable_blog_full_posts', false ) ) {
$link = array( '', '' );
}
$output .= the_title( '' . $link[0], $link[1] . $suffix . '
', false );
} else {
$output .= the_title( '' . $link[0], $link[1] . '
', false );
}
}
$output .= wm_post_meta( $bottom_meta );
$output .= ' ';
//Output
echo apply_filters( 'wmhook_wm_post_title_output', $output );
}
} // /wm_post_title
/**
* Content top
*/
if ( ! function_exists( 'wm_section_content_top' ) ) {
function wm_section_content_top() {
//Helper variables
$output = "\r\n\r\n" . '' . "\r\n";
//Output
echo apply_filters( 'wmhook_wm_section_content_top_output', $output );
}
} // /wm_section_content_top
/**
* Content bottom
*/
if ( ! function_exists( 'wm_section_content_bottom' ) ) {
function wm_section_content_bottom() {
//Helper variables
$output = "\r\n" . ' ' . "\r\n";
//Output
echo apply_filters( 'wmhook_wm_section_content_bottom_output', $output );
}
} // /wm_section_content_bottom
/**
* Entry top
*/
if ( ! function_exists( 'wm_entry_top' ) ) {
function wm_entry_top() {
//Helper variables
$output = '';
//Preparing output
if (
is_home() && apply_filters( 'wmhook_enable_blog_full_posts', false )
|| in_array( get_post_format(), array( 'link', 'quote', 'status' ) )
) {
$output .= '';
}
//Output
echo apply_filters( 'wmhook_wm_entry_top_output', $output );
}
} // /wm_entry_top
/**
* Entry bottom
*/
if ( ! function_exists( 'wm_entry_bottom' ) ) {
function wm_entry_bottom() {
//Helper variables
$is_full_posts = ( is_home() && apply_filters( 'wmhook_enable_blog_full_posts', false ) );
$is_single = ( $is_full_posts ) ? ( true ) : ( is_singular( 'post' ) );
//Post tags
if ( $is_single ) {
echo wm_post_meta( apply_filters( 'wmhook_wm_entry_bottom_meta', array(
'class' => 'entry-meta entry-meta-bottom clearfix',
'meta' => array( 'tags' )
) ) );
}
//Comments
comments_template( null, true );
//Preparing output
if (
$is_full_posts
|| in_array( get_post_format(), array( 'link', 'quote', 'status' ) )
) {
echo ' ';
}
}
} // /wm_entry_bottom
/**
* Footer
*
* @since 1.0
* @version 1.7
*/
if ( ! function_exists( 'wm_section_footer' ) ) {
function wm_section_footer() {
//Helper variables
$output = array();
$post_id = null;
//WooCommerce support
if ( function_exists( 'wm_is_woocommerce' ) && is_shop() ) {
$post_id = wc_get_page_id( 'shop' );
}
//Requirements check
if (
! function_exists( 'wma_meta_option' )
|| 'none' === wma_meta_option( 'footer', $post_id )
) {
get_sidebar( 'footer' );
return;
}
//Preparing output
//Footer widgets
if ( 'credits' !== wma_meta_option( 'footer', $post_id ) ) {
$widget_area_atts = apply_filters( 'wmhook_wm_section_footer_widget_area_atts', array(
'class' => 'widget-area footer-widgets-container',
'sidebar' => 'footer-widgets',
) );
$widget_area = '';
if ( function_exists( 'wma_sidebar' ) ) {
$widget_area = wma_sidebar( $widget_area_atts );
}
if ( $widget_area ) {
$columns = absint( wm_option( 'skin-footer-widgets-layout' ) );
//Count widgets for special class when no masonry applied
$masonry_class = ' masonry-disabled';
$footer_widgets = wp_get_sidebars_widgets();
if (
is_array( $footer_widgets )
&& isset( $footer_widgets['footer-widgets'] )
&& count( $footer_widgets['footer-widgets'] )
&& count( $footer_widgets['footer-widgets'] ) > absint( wm_option( 'skin-footer-widgets-layout' ) )
) {
$masonry_class = ' masonry-enabled';
}
$output[10] = "\r\n\r\n" . ' ' . "\r\n";
}
}
//Credits
if ( 'widgets' !== wma_meta_option( 'footer', $post_id ) ) {
$output[20] = wm_credits();
}
//Top of page button
$output[30] = '';
//Output
$output = apply_filters( 'wmhook_wm_section_footer_output', $output );
echo implode( '', $output );
}
} // /wm_section_footer
/**
* Footer top
*
* @since 1.0
* @version 1.7
*/
if ( ! function_exists( 'wm_section_footer_top' ) ) {
function wm_section_footer_top() {
//Helper variables
$output = '';
$post_id = null;
//WooCommerce support
if ( function_exists( 'wm_is_woocommerce' ) && is_shop() ) {
$post_id = wc_get_page_id( 'shop' );
}
//Requirements check
if (
! function_exists( 'wma_meta_option' )
|| 'none' === wma_meta_option( 'footer', $post_id )
) {
return;
}
//Preparing output
$output = "\r\n\r\n" . '' . "\r\n";
//Output
echo apply_filters( 'wmhook_wm_section_footer_bottom_output', $output );
}
} // /wm_section_footer_bottom
/**
* Credits (copyright) text
*/
if ( ! function_exists( 'wm_credits' ) ) {
function wm_credits() {
//Helper variables
$output = $copy_text = '';
$widget_area_atts = apply_filters( 'wmhook_wm_credits_widget_area_atts', array(
'class' => 'widget-area clearfix',
'max_widgets_count' => 3,
'sidebar' => 'credits',
) );
if ( function_exists( 'wma_sidebar' ) ) {
$copy_text = wma_sidebar( $widget_area_atts );
}
if ( empty( $copy_text ) ) {
$copy_text = '© ' . get_bloginfo( 'name' );
}
//Preparing output
$replacements = array(
'(C)' => '©',
'YEAR' => date( 'Y' ),
);
$copy_text = strtr( $copy_text, $replacements );
$output .= "\r\n\r\n" . '';
$output .= ( wm_option( 'skin-footer-shadow' ) ) ? ( '' ) : ( '' );
$output .= apply_filters( 'wmhook_section_inner_wrappers', '' );
$output .= $copy_text;
$output .= apply_filters( 'wmhook_section_inner_wrappers_close', '' );
$output .= "\r\n" . '' . "\r\n";
//Output
return apply_filters( 'wmhook_wm_credits_output', $output );
}
} // /wm_credits
/**
* Website footer custom scripts
*
* @since 1.0
* @version 1.2.7
*/
if ( ! function_exists( 'wm_footer_custom_scripts' ) ) {
function wm_footer_custom_scripts() {
//Requirements check
if (
! is_singular()
|| ! ( $output = get_post_meta( get_the_id(), 'custom-js', true ) )
) {
return;
}
//Helper variables
$output = "\r\n\r\n\r\n\r\n";
//Output
echo apply_filters( 'wmhook_wm_footer_custom_scripts_output', $output );
}
} // /wm_footer_custom_scripts
/**
* 60) Others
*/
/**
* Register predefined widget areas (sidebars)
*
* @since 1.2.2
*/
if ( ! function_exists( 'wm_register_widget_areas' ) ) {
function wm_register_widget_areas() {
foreach( wm_helper_var( 'widget-areas' ) as $area ) {
register_sidebar( array(
'name' => $area['name'],
'id' => $area['id'],
'description' => $area['description'],
'before_widget' => $area['before_widget'],
'after_widget' => $area['after_widget'],
'before_title' => $area['before_title'],
'after_title' => $area['after_title']
) );
}
}
} // /wm_register_widget_areas
/**
* Admin body classes
*
* @since 1.0
* @version 1.7
*
* @param string $classes
*/
if ( ! function_exists( 'wm_admin_body_class' ) ) {
function wm_admin_body_class( $classes ) {
//Preparing output
$classes .= ' vc-remove-licence-notice';
$classes .= ' bbp-hide-content-container';
if ( function_exists( 'wm_is_woocommerce' ) ) {
$classes .= ' wc-remove-frontend_css_secondary';
$classes .= ' wc-remove-frontend_css_content_bg';
}
//Output
return $classes;
}
} // /wm_admin_body_class
/**
* Logo URL modifications
*
* @param array $args
*/
if ( ! function_exists( 'wm_logo_url' ) ) {
function wm_logo_url( $args ) {
//Preparing output
if ( is_page_template( 'page-template/one-page.php' ) ) {
$args['url'] = '#top';
}
//Output
return $args;
}
} // /wm_logo_url
/**
* Navigation ative item shadow calculation
*
* @param absint $color_brightness [0,255]
* @param absint $min Minimal value of the output
*
* @return absint CSS opacity value, but in percent [0,100]
*/
if ( ! function_exists( 'wm_nav_shadow_opacity' ) ) {
function wm_nav_shadow_opacity( $color_brightness = 0, $min = 0 ) {
//Helper variable
$output = 50;
//Preparing output
//Brightness value into percents [0,100]
$color_brightness = absint( round( $color_brightness / 2.55 ) );
//Calculation
$output = ( 120 * pow( .965, $color_brightness ) ) + 5;
//Make sure the output is inside [0,100]
$output = absint( round( $output ) );
if ( absint( $min ) >= $output ) {
$output = $min;
}
if ( 100 < $output ) {
$output = 100;
}
//Output
return apply_filters( 'wmhook_wm_nav_shadow_opacity_output', $output, $color_brightness, $min );
}
} // /wm_nav_shadow_opacity
/**
* Media uploader image sizes
*
* @param array $sizes
*/
if ( ! function_exists( 'wm_media_uploader_image_sizes' ) ) {
function wm_media_uploader_image_sizes( $sizes ) {
//Modify sizes array
$sizes['content-width'] = __( 'Content width', 'mustang-lite' );
$sizes['mobile'] = __( 'Mobile width', 'mustang-lite' );
//Output
return apply_filters( 'wmhook_wm_media_uploader_image_sizes_output', $sizes );
}
} // /wm_media_uploader_image_sizes
/**
* Schema.org function wrapper
*
* @version 1.6
*
* @param string $element
* @param boolean $output_meta_tag
*/
if ( ! function_exists( 'wm_schema_org' ) ) {
function wm_schema_org( $element = '', $output_meta_tag = false ) {
return;
}
} // /wm_schema_org
/**
* Previous and next post/project links
*/
if ( ! function_exists( 'wm_prevnext_post' ) ) {
function wm_prevnext_post() {
//Requirements check
if ( ! ( is_singular( 'post' ) || is_singular( 'wm_projects' ) ) ) {
return;
}
//Helper variables
$excluded_categories = $output = '';
$in_same_cat = true;
$taxonomy = ( 'wm_projects' == get_post_type() ) ? ( 'project_category' ) : ( 'category' );
$taxonomy = apply_filters( 'wmhook_wm_prevnext_post_taxonomy', $taxonomy );
$posts = array(
get_previous_post( $in_same_cat, $excluded_categories, $taxonomy ),
get_next_post( $in_same_cat, $excluded_categories, $taxonomy ),
);
//Preparing output
if ( $posts[0] ) {
$output .= '' . trim( get_the_title( $posts[0]->ID ) ) . '';
}
if ( $posts[1] ) {
$output .= '' . trim( get_the_title( $posts[1]->ID ) ) . '';
}
if ( $output ) {
$output = ' ';
}
//Output
echo apply_filters( 'wmhook_wm_prevnext_post_output', $output );
}
} // /wm_prevnext_post
/**
* Sidebar setup array
*
* @since 1.0
* @version 1.7
*
* @param string $return Specify which output array key to return.
* @param array $atts
*/
if ( ! function_exists( 'wm_sidebar_setup' ) ) {
function wm_sidebar_setup( $return = false, $atts = array() ) {
//Helper variables
$output = apply_filters( 'wmhook_wm_sidebar_setup_output_defaults', array(
'class_main' => ' twelve pane',
'class_sidebar' => '',
'output' => '',
'position' => 'none',
) );
//Requirements check
if ( ! function_exists( 'wma_sidebar' ) ) {
if ( ! $return ) {
return $output;
} else {
if ( isset( $output[ $return ] ) ) {
return $output[ $return ];
} else {
return;
}
}
}
$defaults = array(
'page_id' => null,
'position' => ( wm_option( 'skin-sidebar-position' ) ) ? ( wm_option( 'skin-sidebar-position' ) ) : ( WM_DEFAULT_SIDEBAR_POSITION ),
);
$sidebar_none_posts = apply_filters( 'wmhook_sidebar_none_posts', array(
'wm_projects',
'page',
) );
if (
( is_archive() && apply_filters( 'wmhook_archive_disable_sidebar', false ) )
|| ( is_singular( $sidebar_none_posts ) && ! is_page_template( 'home.php' ) )
) {
$defaults['position'] = 'none';
}
$defaults = apply_filters( 'wmhook_wm_sidebar_setup_defaults', $defaults );
$atts = wp_parse_args( $atts, $defaults );
if (
(
( is_home() || is_singular() )
|| ( function_exists( 'wm_is_woocommerce' ) && is_shop() ) //WooCommerce support
)
&& function_exists( 'wma_meta_option' )
&& wma_meta_option( 'sidebar', $atts['page_id'] )
) {
$atts['position'] = wma_meta_option( 'sidebar', $atts['page_id'] );
}
if (
is_singular()
&& 'sections' == wma_meta_option( 'sidebar', $atts['page_id'] )
) {
$defaults['position'] = 'none';
}
$atts = apply_filters( 'wmhook_wm_sidebar_setup_atts', $atts );
//Preparing output
if ( 'none' !== $atts['position'] ) {
$classes = ( wm_option( 'skin-sidebar-width' ) ) ? ( wm_option( 'skin-sidebar-width' ) ) : ( WM_DEFAULT_SIDEBAR_WIDTH );
//First array value is for sidebar width, the second for content width
$classes = explode( ';', $classes );
if ( isset( $classes[0] ) ) {
$output['class_sidebar'] = $classes[0];
}
if ( isset( $classes[1] ) ) {
if ( 'left' === $atts['position'] ) {
$classes[1] .= ' sidebar-left';
}
$output['class_main'] = $classes[1];
}
}
$output['position'] = $atts['position'];
//Actuall sidebar HTML output
if ( 'none' !== $output['position'] ) {
$output['output'] = wma_sidebar( apply_filters( 'wmhook_wm_sidebar_setup_sidebar_atts', array(
'attributes' => ' role="complementary"',
'class' => 'sidebar widget-area clearfix sidebar-' . esc_attr( $output['position'] . $output['class_sidebar'] ),
'sidebar' => 'general',
), $atts ) );
}
//If no sidebar to output, set fullwidth layout
if ( ! $output['output'] ) {
$output = array(
'class_main' => ' twelve pane',
'class_sidebar' => '',
'output' => '',
'position' => 'none',
);
}
//Output
$output = apply_filters( 'wmhook_wm_sidebar_setup_output', $output, $atts );
if ( ! $return ) {
return $output;
} else {
if ( isset( $output[ $return ] ) ) {
return $output[ $return ];
} else {
return;
}
}
}
} // /wm_sidebar_setup
/**
* Blog page template
*/
/**
* Blog page template query setup
*
* @return object WordPress query
*/
if ( ! function_exists( 'wm_blog_page_query' ) ) {
function wm_blog_page_query() {
//Helper variables
global $paged, $page, $wm_blog_page_id;
//Requirements check
if (
! function_exists( 'wma_meta_option' )
|| ! $wm_blog_page_id
) {
return;
}
$page = get_query_var( 'page' );
$paged = ( isset( $paged ) && $paged ) ? ( $paged ) : ( 1 );
$pagination_page = 1;
if ( $page || $paged ) {
$pagination_page = max( $page, $paged );
}
$article_count = wma_meta_option( 'blog-posts-count', $wm_blog_page_id );
$cats_action = ( wma_meta_option( 'blog-categories-action', $wm_blog_page_id ) ) ? ( wma_meta_option( 'blog-categories-action', $wm_blog_page_id ) ) : ( 'category__in' );
$cats = ( wma_meta_option( 'blog-categories', $wm_blog_page_id ) ) ? ( array_filter( wma_meta_option( 'blog-categories', $wm_blog_page_id ) ) ) : ( array() );
//Get categories IDs in array
if ( 0 < count( $cats ) ) {
$cat_temp = array();
foreach ( $cats as $cat ) {
if ( isset( $cat['category'] ) && $cat['category'] ) {
$cat = $cat['category'];
if ( ! is_numeric( $cat ) ) {
//Category slugs to IDs
$cat_object = get_category_by_slug( $cat );
$cat_temp[] = ( is_object( $cat_object ) && isset( $cat_object->term_id ) ) ? ( $cat_object->term_id ) : ( null );
} else {
$cat_temp[] = $cat;
}
}
}
array_filter( $cat_temp ); //remove empty (if any)
$cats = $cat_temp;
}
//Preparing output
$query_args = array(
'posts_per_page' => absint( $article_count ),
'paged' => absint( $pagination_page )
);
if ( 0 < count( $cats ) ) {
$query_args[ $cats_action ] = $cats;
}
$blog_posts = new WP_Query( apply_filters( 'wmhook_wm_blog_page_query_args', $query_args, $wm_blog_page_id ) );
//Output
return apply_filters( 'wmhook_wm_blog_page_query_output', $blog_posts );
}
} // /wm_blog_page_query
/**
* Blog page template pagination query
*
* @param array $atts
*/
if ( ! function_exists( 'wm_pagination_blog' ) ) {
function wm_pagination_blog( $atts ) {
//Preparing output
if ( is_page_template( 'home.php' ) && ! is_home() ) {
$atts['query'] = wm_blog_page_query();
}
//Output
return $atts;
}
} // /wm_pagination_blog
/**
* hAtom microformats
*/
/**
* Adding required hAttom microformats for better SEO
*/
if ( ! function_exists( 'wm_hatom_microformats' ) ) {
function wm_hatom_microformats() {
//Helper variables
$output = '';
//Preparing output
if ( is_singular( array( 'wm_projects', 'page' ) ) ) {
//For projects and pages only, posts are fine already
$output .= ' ';
}
//Output
echo apply_filters( 'wmhook_wm_hatom_microformats_output', $output );
}
} // /wm_hatom_microformats
/**
* Pagination fallback
*
* This pagination function is used only if the WebMan Amplifier not active.
*
* @since 1.1.1
* @version 1.4
*/
if ( ! function_exists( 'wm_pagination' ) ) {
function wm_pagination() {
//Helper variables
global $wp_query, $wp_rewrite;
$output = '';
$pagination = array(
'prev_text' => '«',
'next_text' => '»',
);
//Output
echo '' . paginate_links( $pagination ) . '';
}
} // /wm_pagination
/**
* Plugins integration
*/
/**
* WebMan Amplifier plugin integration
*/
if ( function_exists( 'wma_amplifier' ) ) {
locate_template( WM_SETUP_DIR . 'setup-webman-amplifier.php', true );
}
/**
* Breadcrumb NavXT
*/
/**
* Don't display breadcrumbs settings for posts with no single view
*
* @param boolean $display
* @param string $post_type
*/
if ( ! function_exists( 'wm_bcn_settings' ) ) {
function wm_bcn_settings( $display = true, $post_type = '' ) {
//Helper variables
$redirects = apply_filters( 'wmhook_custom_post_redirects', array(
'wm_logos' => home_url(),
'wm_modules' => home_url(),
'wm_staff' => home_url(),
'wm_testimonials' => home_url(),
) );
//Preparing output
if ( in_array( $post_type, array_keys( $redirects ) ) ) {
$display = false;
}
//Output
return $display;
}
} // /wm_bcn_settings
/**
* WooSidebars integration
*/
/**
* Altering default sidebar args
*
* Hooking onto 'dynamic_sidebar_params' filter to alter the default
* WordPress args for registered sidebars. This way we can make the
* default wrapper around the sidebar widget a DIV for example
* and change the widget heading tag.
*
* @param string $params
*/
if ( ! function_exists( 'wm_ws_default_sidebar_params' ) ) {
function wm_ws_default_sidebar_params( $params ) {
//Preparing output
if (
! isset( $params[0]['after_widget'] )
|| '