esc_html__( ' - do not use Google Font', 'auberge' ),
// Default theme font
'optgroup' . $i => esc_html_x( 'Theme default', 'Google Font default setup options group title.', 'auberge' ),
'Ubuntu:400,300' => 'Ubuntu',
'/optgroup' . $i => '',
// Insipration from http://femmebot.github.io/google-type/
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Playfair Display' => 'Playfair Display',
'Fauna One' => 'Fauna One',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Fugaz One' => 'Fugaz One',
'Oleo Script' => 'Oleo Script',
'Monda' => 'Monda',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Unica One' => 'Unica One',
'Vollkorn' => 'Vollkorn',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Megrim' => 'Megrim',
'Roboto Slab:400,300,100' => 'Roboto Slab',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Open Sans:400,300' => 'Open Sans',
'Gentium Basic' => 'Gentium Basic',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Ovo' => 'Ovo',
'Muli:300,400' => 'Muli',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Neuton:200,300,400' => 'Neuton',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Quando' => 'Quando',
'Judson' => 'Judson',
'Montserrat' => 'Montserrat',
'/optgroup' . $i => '',
'optgroup' . ++$i => sprintf( esc_html_x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'auberge' ), $i ),
'Ultra' => 'Ultra',
'Stint Ultra Expanded' => 'Stint Ultra Expanded',
'Slabo 13px' => 'Slabo 13px',
'/optgroup' . $i => '',
// Google Fonts selection
'optgroup' . ++$i => esc_html_x( 'Fonts selection', 'Title for selection of fonts picked from Google Fontss', 'auberge' ),
'Abril Fatface' => 'Abril Fatface',
'Arvo' => 'Arvo',
'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',
'Nixie One' => 'Nixie One',
'Noto Sans' => 'Noto Sans',
'Numans' => 'Numans',
'Nunito:400,300' => 'Nunito',
'Old Standard TT' => 'Old Standard TT',
'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 Condensed' => 'Ubuntu Condensed',
'Yanone Kaffeesatz:400,300' => 'Yanone Kaffeesatz',
'/optgroup' . $i => '',
);
// 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',
);
// Widget areas
$output['widget-areas'] = array(
'sidebar' => array(
'name' => esc_html__( 'Sidebar', 'auberge' ),
'description' => esc_html__( 'Page sidebar.', 'auberge' ),
),
'front-page' => array(
'name' => esc_html__( 'Front Page Widgets', 'auberge' ),
'description' => esc_html__( 'This widgets area is displayed below the Banner area on the front page (homepage).', 'auberge' ),
),
'footer' => array(
'name' => esc_html__( 'Footer Widgets', 'auberge' ),
'description' => esc_html__( 'Masonry layout is used to display footer widgets.', 'auberge' ),
),
);
// Output
$output = apply_filters( 'wmhook_wm_helper_var_output', $output );
if ( isset( $output[ $variable ] ) ) {
$output = $output[ $variable ];
if ( null !== $key && isset( $output[ $key ] ) ) {
$output = $output[ $key ];
}
} else {
$output = '';
}
return $output;
}
} // /wm_helper_var
/**
* 20) Theme setup
*/
/**
* Theme setup
*
* @since 1.0
* @version 2.0
*/
if ( ! function_exists( 'wm_setup' ) ) {
function wm_setup() {
// Helper variables
$image_sizes = array_filter( apply_filters( 'wmhook_wm_setup_image_sizes', array() ) );
// WordPress visual editor CSS stylesheets
$visual_editor_css = array_filter( (array) apply_filters( 'wmhook_wm_setup_visual_editor_css', array(
str_replace( ',', '%2C', wm_google_fonts_url() ),
esc_url_raw( add_query_arg( array( 'ver' => wp_get_theme( get_template() )->get( 'Version' ) ), wm_get_stylesheet_directory_uri( 'assets/fonts/genericons/genericons.css' ) ) ),
esc_url_raw( add_query_arg( array( 'ver' => wp_get_theme( get_template() )->get( 'Version' ) ), wm_get_stylesheet_directory_uri( 'assets/css/editor-style.css' ) ) ),
) ) );
add_editor_style( $visual_editor_css );
// Processing
// Localization
/**
* Note: the first-loaded translation file overrides any following ones if the same translation is present.
*/
// wp-content/languages/theme-name/it_IT.mo
load_theme_textdomain( 'auberge', trailingslashit( WP_LANG_DIR ) . 'themes/auberge' );
// wp-content/themes/child-theme-name/languages/it_IT.mo
load_theme_textdomain( 'auberge', get_stylesheet_directory() . '/languages' );
// wp-content/themes/theme-name/languages/it_IT.mo
load_theme_textdomain( 'auberge', get_template_directory() . '/languages' );
// Custom menus
register_nav_menus( apply_filters( 'wmhook_wm_setup_menus', array(
'primary' => esc_html__( 'Primary Menu', 'auberge' ),
'social' => esc_html__( 'Social Links Menu', 'auberge' ),
) ) );
// Post types supports
add_post_type_support( 'attachment:audio', 'thumbnail' );
add_post_type_support( 'attachment:video', 'thumbnail' );
add_post_type_support( 'attachment', 'custom-fields' );
// Indicate widget sidebars can use selective refresh in the Customizer
add_theme_support( 'customize-selective-refresh-widgets' );
// Title tag
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
*/
add_theme_support( 'title-tag' );
// Site logo
/**
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo' );
// Feed links
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#Feed_Links
*/
add_theme_support( 'automatic-feed-links' );
// Enable HTML5 markup
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
*/
add_theme_support( 'html5', array(
'comment-list',
'comment-form',
'search-form',
'gallery',
'caption',
) );
// Custom header
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Header
*/
add_theme_support( 'custom-header', apply_filters( 'wmhook_wm_setup_custom_header_args', array(
'default-image' => wm_get_stylesheet_directory_uri( 'assets/images/header.jpg' ),
'header-text' => false,
'width' => ( isset( $image_sizes['auberge_banner'] ) ) ? ( $image_sizes['auberge_banner'][0] ) : ( 1920 ),
'height' => ( isset( $image_sizes['auberge_banner'] ) ) ? ( $image_sizes['auberge_banner'][1] ) : ( 1080 ),
'flex-height' => false,
'flex-width' => false,
) ) );
// Custom background
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Background
*/
add_theme_support( 'custom-background', apply_filters( 'wmhook_wm_setup_custom_background_args', array(
'default-color' => 'eaecee',
) ) );
// Thumbnails support
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails', array( 'attachment:audio', 'attachment:video' ) );
add_theme_support( 'post-thumbnails' );
// Image sizes (x, y, crop)
if ( ! empty( $image_sizes ) ) {
foreach ( $image_sizes as $size => $setup ) {
if (
in_array( $size, array( 'thumbnail', 'medium', 'large' ) )
&& ! get_theme_mod( '__image_size-' . $size )
) {
/**
* Force the default image sizes on theme installation only.
* This allows users to set their own sizes later, but a notification is displayed.
*/
$original_image_width = get_option( $size . '_size_w' );
if ( $image_sizes[ $size ][0] != $original_image_width ) {
update_option( $size . '_size_w', $image_sizes[ $size ][0] );
}
$original_image_height = get_option( $size . '_size_h' );
if ( $image_sizes[ $size ][1] != $original_image_height ) {
update_option( $size . '_size_h', $image_sizes[ $size ][1] );
}
$original_image_crop = get_option( $size . '_crop' );
if ( $image_sizes[ $size ][2] != $original_image_crop ) {
update_option( $size . '_crop', $image_sizes[ $size ][2] );
}
set_theme_mod(
'__image_size-' . $size,
array(
$original_image_width,
$original_image_height,
$original_image_crop
)
);
} else {
add_image_size(
$size,
$image_sizes[ $size ][0],
$image_sizes[ $size ][1],
$image_sizes[ $size ][2]
);
}
} // /foreach
}
}
} // /wm_setup
add_action( 'after_setup_theme', 'wm_setup', 10 );
/**
* Theme version 2.0 upgrade admin notice
*
* @since 2.0
* @version 2.0
*
* @param float $current_theme_version
* @param float $new_theme_version
*/
if ( ! function_exists( 'wm_theme_v2_upgrade_notice' ) ) {
function wm_theme_v2_upgrade_notice( $current_theme_version, $new_theme_version ) {
// Processing
if (
version_compare( $current_theme_version, '2.0', '<' )
&& is_child_theme()
) {
set_transient(
'auberge_admin_notice',
array(
esc_html__( 'Thank you for upgrading your theme.', 'auberge' )
. ' ' . esc_html__( 'We have noticed you are using a child theme.', 'auberge' )
. '
'
. esc_html__( 'Please note that there has been a lot of changes in this new theme version and you should check the code in your child theme for compatibility!', 'auberge' )
. ''
. '
'
. esc_html__( 'Read theme changelog »', 'auberge' )
. '',
'notice-error',
'switch_themes',
3
),
( 60 * 60 * 48 )
);
}
}
} // /wm_theme_v2_upgrade_notice
add_action( 'wmhook_theme_upgrade', 'wm_theme_v2_upgrade_notice', 10, 2 );
/**
* Setup images
*/
/**
* Image sizes
*
* @example
*
* $image_sizes = array(
* 'image_size_id' => array(
* absint( width ),
* absint( height ),
* (bool) cropped?,
* (string) optional_theme_usage_explanation_text
* )
* );
*
* @since 1.4
* @version 2.0
*
* @param array $image_sizes
*/
if ( ! function_exists( 'wm_image_sizes' ) ) {
function wm_image_sizes( $image_sizes = array() ) {
// Helper variables
global $content_width;
// Processing
$image_sizes = array(
'thumbnail' => array(
480,
280,
true,
esc_html__( 'In posts list.', 'auberge' )
),
'medium' => array(
absint( $content_width * .62 ),
9999,
false
),
'large' => array(
absint( $content_width ),
9999,
false,
esc_html__( 'In single post page.', 'auberge' )
),
'auberge_banner' => array(
1640,
686, //@link http://en.wikipedia.org/wiki/Anamorphic_format
true,
esc_html__( 'In front page banner.', 'auberge' )
),
'auberge_banner_small' => array(
absint( $content_width ),
absint( $content_width / 2.39 ), //@link http://en.wikipedia.org/wiki/Anamorphic_format
true,
esc_html__( 'In food menu list.', 'auberge' )
),
);
// Output
return $image_sizes;
}
} // /wm_image_sizes
add_filter( 'wmhook_wm_setup_image_sizes', 'wm_image_sizes' );
/**
* Reset predefined image sizes to their original values
*
* @since 2.0
* @version 2.0
*/
if ( ! function_exists( 'wm_image_sizes_reset' ) ) {
function wm_image_sizes_reset() {
// Helper variables
$image_sizes = array( 'thumbnail', 'medium', 'large' );
$theme_old = get_option( 'theme_switched' );
$theme_mods = get_option( 'theme_mods_' . $theme_old );
$update_theme_mods = false;
// Processing
foreach ( $image_sizes as $size ) {
$values = (array) ( isset( $theme_mods[ '__image_size-' . $size ] ) ) ? ( $theme_mods[ '__image_size-' . $size ] ) : ( array() );
// Skip processing if we do not have the image height and crop value
if ( ! isset( $values[1] ) || ! isset( $values[2] ) ) {
continue;
}
// Old image width
if ( $values[0] ) {
update_option( $size . '_size_w', $values[0] );
}
// Old image height
if ( $values[1] ) {
update_option( $size . '_size_h', $values[1] );
}
// Old image crop
if ( $values[2] ) {
update_option( $size . '_crop', $values[2] );
}
// Remove the image settings from theme mods for future reset
unset( $theme_mods[ '__image_size-' . $size ] );
$update_theme_mods = true;
} // /foreach
if ( $update_theme_mods ) {
update_option( 'theme_mods_' . $theme_old, $theme_mods );
}
}
} // /wm_image_sizes_reset
add_action( 'switch_theme', 'wm_image_sizes_reset' );
/**
* Register recommended image sizes notice
*
* @since 1.4
* @version 1.4
*/
if ( ! function_exists( 'wm_image_size_notice' ) ) {
function wm_image_size_notice() {
// Processing
add_settings_field(
// $id
'recommended-image-sizes',
// $title
'',
// $callback
'wm_image_size_notice_html',
// $page
'media',
// $section
'default',
// $args
array()
);
register_setting(
// $option_group
'media',
// $option_name
'recommended-image-sizes',
// $sanitize_callback
'esc_attr'
);
}
} // /wm_image_size_notice
add_action( 'admin_init', 'wm_image_size_notice' );
/**
* Display recommended image sizes notice
*
* @since 1.4
* @version 1.4
*/
if ( ! function_exists( 'wm_image_size_notice_html' ) ) {
function wm_image_size_notice_html() {
// Helper variables
$default_image_size_names = array(
'thumbnail' => esc_html_x( 'Thumbnail size', 'WordPress predefined image size name.', 'auberge' ),
'medium' => esc_html_x( 'Medium size', 'WordPress predefined image size name.', 'auberge' ),
'large' => esc_html_x( 'Large size', 'WordPress predefined image size name.', 'auberge' ),
);
$image_sizes = array_filter( apply_filters( 'wmhook_wm_setup_image_sizes', array() ) );
// Requirements check
if ( empty( $image_sizes ) ) {
return;
}
// Output
// Section styles
echo '';
// Section HTML
echo '
' . esc_html__( 'For the theme to work correctly, please, set these recommended image sizes:', 'auberge' ) . '
'; echo '| ' . esc_html__( 'Size name', 'auberge' ) . ' | ' . '' . esc_html__( 'Size parameters', 'auberge' ) . ' | ' . '' . esc_html__( 'Theme usage', 'auberge' ) . ' | ' . '
|---|---|---|
| ' . esc_html( $default_image_size_names[ $size ] ) . ': | '; } else { echo '||
' . esc_html( $size ) . ': | ';
}
echo '' . sprintf( esc_html_x( '%1$d × %2$d, %3$s', '1: image width, 2: image height, 3: cropped or scaled?', 'auberge' ), absint( $setup[0] ), absint( $setup[1] ), $crop ) . ' | ' . '' . ( ( isset( $setup[3] ) ) ? ( $setup[3] ) : ( '—' ) ) . ' | ' . '
' . get_the_excerpt() . '
'; } else { $excerpt = ''; } $excerpt = apply_filters( 'the_content', $excerpt . get_the_content( '' ) ); } else { /** * Default excerpt for posts without more tag */ $excerpt = strtr( $excerpt, apply_filters( 'wmhook_wm_excerpt_replacements', array( ''
' . sprintf( esc_html__( 'Continue reading%s…', 'auberge' ), ' "' . get_the_title() . '"' ) . ''; return '
'; } } // /wm_excerpt_continue_reading add_filter( 'wmhook_wm_excerpt_continue_reading', 'wm_excerpt_continue_reading', 10 ); /** * Display excerpt on single post page * * @since 2.0 * @version 2.0 */ if ( ! function_exists( 'wm_excerpt_single_post' ) ) { function wm_excerpt_single_post() { // Helper variables $post_id = get_the_ID(); // Requirements check if ( ! is_single( $post_id ) || ! has_excerpt( $post_id ) || wm_paginated_suffix() || get_theme_mod( 'others-single-post-excerpt-disable' ) ) { return; } // Output the_excerpt(); } } // /wm_excerpt_single_post add_action( 'tha_entry_content_before', 'wm_excerpt_single_post', 10 ); /** * Pagination * * @since 1.0 * @version 2.0 */ if ( ! function_exists( 'wm_pagination' ) ) { function wm_pagination() { // Requirements check // Don't display pagination if Jetpack Infinite Scroll in use if ( class_exists( 'The_Neverending_Home_Page' ) ) { return; } // Helper variables $output = ''; $pagination = array( 'prev_text' => esc_html_x( '«', 'Pagination text (visible): previous.', 'auberge' ) . ' ' . esc_html_x( 'Previous page', 'Pagination text (hidden): previous.', 'auberge' ) . '', 'next_text' => '' . esc_html_x( 'Next page', 'Pagination text (hidden): next.', 'auberge' ) . ' ' . esc_html_x( '»', 'Pagination text (visible): next.', 'auberge' ), ); // Processing if ( $output = paginate_links( $pagination ) ) { $output = ''; } // Output echo $output; } } // /wm_pagination add_action( 'wmhook_postslist_after', 'wm_pagination', 10 ); /** * Front page blog more link * * @since 1.0 * @version 1.0 */ if ( ! function_exists( 'wm_blog_more_link' ) ) { function wm_blog_more_link() { // Output if ( $page_for_posts_id = absint( get_option( 'page_for_posts' ) ) ) { echo ''; } } } // /wm_blog_more_link add_action( 'wmhook_loop_blog_condensed_postslist_after', 'wm_blog_more_link', 10 ); /** * Front page food menu more link * * @since 1.0 * @version 2.0 */ if ( ! function_exists( 'wm_food_menu_more_link' ) ) { function wm_food_menu_more_link() { // Helper variables $food_menu_page_id = intval( get_transient( 'auberge-page-template-food-menu' ) ); // Output if ( 1 <= $food_menu_page_id && ! is_page_template( 'page-template/_menu.php' ) ) { echo ''; } } } // /wm_food_menu_more_link add_action( 'wmhook_loop_food_menu_postslist_after', 'wm_food_menu_more_link', 10 ); /** * Footer widgets * * @since 2.0 * @version 2.0 */ if ( ! function_exists( 'wm_footer_widgets' ) ) { function wm_footer_widgets() { // Output get_sidebar( 'footer' ); } } // /wm_footer_widgets add_action( 'tha_footer_top', 'wm_footer_widgets', 110 ); /** * Footer credits * * @since 2.0 * @version 2.0 */ if ( ! function_exists( 'wm_footer_credits' ) ) { function wm_footer_credits() { // Output get_footer( 'credits' ); } } // /wm_footer_credits add_action( 'tha_footer_top', 'wm_footer_credits', 120 ); /** * Footer top * * @since 1.0 * @version 2.0 */ if ( ! function_exists( 'wm_footer_top' ) ) { function wm_footer_top() { // Output echo "\r\n\r\n" . '' . "\r\n\r\n"; } } // /wm_footer_bottom add_action( 'tha_footer_bottom', 'wm_footer_bottom', 100 ); /** * 100) Other functions */ /** * Ignore sticky posts in main loop * * @since 1.0 * @version 1.4 * * @param obj $query */ if ( ! function_exists( 'wm_posts_query_ignore_sticky_posts' ) ) { function wm_posts_query_ignore_sticky_posts( $query ) { // Processing if ( $query->is_main_query() ) { $query->set( 'ignore_sticky_posts', 1 ); } } } // /wm_posts_query_ignore_sticky_posts add_action( 'pre_get_posts', 'wm_posts_query_ignore_sticky_posts' ); /** * Include additional JavaScript when [gallery] shortcode used * * Not really satisfied with this solution as we're hooking into filter, * but have no choice as there is no action hook in the gallery_shortcode() * WordPress function. * * @see wp-includes/media.php > gallery_shortcode() * * @param string $output * @param array $attr */ if ( ! function_exists( 'wm_shortcode_gallery_assets' ) ) { function wm_shortcode_gallery_assets( $output, $attr ) { // Processing wp_enqueue_script( 'jquery-masonry' ); // Output return $output; } } // /wm_shortcode_gallery_assets add_filter( 'post_gallery', 'wm_shortcode_gallery_assets', 10, 2 ); /** * Get the "Food Menu" page template page ID * * Returns -1 when no page ID with the page template found. * * @since 1.0 * @version 2.0 */ if ( ! function_exists( 'wm_food_menu_page_template_id' ) ) { function wm_food_menu_page_template_id() { // Processing if ( false === ( $cached_page_id = get_transient( 'auberge-page-template-food-menu' ) ) ) { $cached_page_id = -1; $the_query = new WP_Query(array( 'post_type' => 'page', 'posts_per_page' => 1, 'paged' => 1, 'meta_key' => '_wp_page_template', 'meta_value' => 'page-template/_menu.php' ) ); if ( $the_query->have_posts() && isset( $the_query->posts[0]->ID ) ) { $cached_page_id = absint( $the_query->posts[0]->ID ); } set_transient( 'auberge-page-template-food-menu', $cached_page_id ); } // Output return $cached_page_id; } } // /wm_food_menu_page_template_id add_action( 'after_setup_theme', 'wm_food_menu_page_template_id', 20 ); /** * Flush out the transients used in wm_food_menu_page_template_id * * @since 1.0 * @version 2.0 */ if ( ! function_exists( 'wm_food_menu_page_template_transient_flusher' ) ) { function wm_food_menu_page_template_transient_flusher() { // Processing delete_transient( 'auberge-page-template-food-menu' ); } } // /wm_food_menu_page_template_transient_flusher add_action( 'save_post', 'wm_food_menu_page_template_transient_flusher', 10 ); /** * Font CSS name * * @since 1.0 * @version 1.0 * * @param string $value @see wm_custom_styles_value() * @param array $skin_option @see wm_custom_styles_value() */ if ( ! function_exists( 'wm_css_font_name' ) ) { function wm_css_font_name( $value, $skin_option ) { // Helper variables $helper = wm_helper_var( 'google-fonts' ); // Processing if ( isset( $skin_option['id'] ) && false !== strpos( $skin_option['id'], 'font-family' ) && is_string( $value ) ) { $value = trim( $value ); if ( isset( $helper[ $value ] ) ) { $value = "'" . $helper[ $value ] . "', "; } } // Output return $value; } } // /wm_css_font_name add_filter( 'wmhook_wm_custom_styles_value', 'wm_css_font_name', 10, 2 ); /** * Get Google Fonts link * * Returns a string such as: * //fonts.googleapis.com/css?family=Alegreya+Sans:300,400|Exo+2:400,700|Allan&subset=latin,latin-ext * * @since 1.0 * @version 1.4.8 * * @param array $fonts Fallback fonts. */ if ( ! function_exists( 'wm_google_fonts_url' ) ) { function wm_google_fonts_url( $fonts = array() ) { // Helper variables $output = ''; $family = array(); $subset = get_theme_mod( 'font-subset' ); $fonts_setup = array_unique( array_filter( (array) apply_filters( 'wmhook_wm_google_fonts_url_fonts_setup', array() ) ) ); if ( empty( $fonts_setup ) && ! empty( $fonts ) ) { $fonts_setup = (array) $fonts; } // Requirements check if ( empty( $fonts_setup ) ) { return apply_filters( 'wmhook_wm_google_fonts_url_output', $output ); } // Processing foreach ( $fonts_setup as $section ) { $font = trim( $section ); if ( $font ) { $family[] = str_replace( ' ', '+', $font ); } } if ( ! empty( $family ) ) { $output = esc_url_raw( add_query_arg( array( 'family' => implode( '|', (array) array_unique( $family ) ), 'subset' => implode( ',', (array) $subset ), //Subset can be array if multiselect Customizer input field used ), '//fonts.googleapis.com/css' ) ); } // Output return apply_filters( 'wmhook_wm_google_fonts_url_output', $output ); } } // /wm_google_fonts_url /** * Schema.org markup on HTML tags * * @since 1.0 * @version 2.0 * * @param string $element * @param boolean $output_meta_tag */ if ( ! function_exists( 'wm_schema_org' ) ) { function wm_schema_org( $element = '', $output_meta_tag = false ) { // Pre $pre = apply_filters( 'wmhook_wm_schema_org_pre', false, $element, $output_meta_tag ); if ( false !== $pre ) { return $pre; } // Requirements check if ( empty( $element ) ) { return; } // Helper variables $output = ''; $base = apply_filters( 'wmhook_wm_schema_org_base', 'https://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 $creative_work_array = (array) apply_filters( 'wmhook_schema_org_creative_work_array', array( 'jetpack-portfolio' ), $element, $output_meta_tag ); // Processing switch ( $element ) { case 'author': $output = 'itemprop="author"'; break; case 'BreadcrumbList': $output = 'itemscope itemtype="' . $base . 'BreadcrumbList"'; break; case 'datePublished': $output = 'itemprop="datePublished"'; break; case 'dateModified': $output = 'itemprop="dateModified"'; break; case 'entry': $output = 'itemscope '; if ( is_page() ) { $output .= 'itemtype="' . $base . 'WebPage"'; } elseif ( is_singular( $creative_work_array ) ) { $output .= 'itemprop="workExample" itemtype="' . $base . 'CreativeWork"'; } else { $output .= ( is_single( get_the_ID() ) ) ? ( 'itemprop="blogPost"' ) : ( 'itemprop="itemListElement"' ); $output .= ' itemtype="' . $base . 'BlogPosting"'; } break; case 'entry_body': if ( ! is_single( get_the_ID() ) ) { $output = 'itemprop="description"'; } else { $output = 'itemprop="articleBody"'; } break; case 'headline': $output = 'itemprop="headline"'; break; case 'height': $output = 'itemprop="height"'; break; case 'image': $output = 'itemprop="image" itemscope itemtype="' . $base . 'ImageObject"'; break; case 'ItemList': $output = 'itemscope itemtype="' . $base . 'ItemList"'; break; case 'keywords': $output = 'itemprop="keywords"'; break; case 'mainEntityOfPage': $output = 'itemprop="mainEntityOfPage"'; break; case 'mainContentOfPage': $output = 'itemprop="mainContentOfPage"'; break; case 'name': $output = 'itemprop="name"'; break; case 'Person': $output = 'itemscope itemtype="' . $base . 'Person"'; break; case 'ProfilePage': $output = 'itemscope itemtype="' . $base . 'ProfilePage"'; break; case 'SiteNavigationElement': $output = 'itemscope itemtype="' . $base . 'SiteNavigationElement"'; break; case 'url': $output = 'itemprop="url"'; break; case 'WebPage': if ( ! is_singular() ) { $output .= 'itemscope itemtype="' . $base . 'WebPage"'; } break; case 'width': $output = 'itemprop="width"'; 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 ( is_string( $output_meta_tag ) ) { $output .= ' content="' . esc_attr( trim( $output_meta_tag ) ) . '"'; } else { $output .= ' content="true"'; } $output = ''; } // Output return apply_filters( 'wmhook_wm_schema_org_output', $output, $element, $output_meta_tag ); } } // /wm_schema_org /** * 999) Plugins integration */ // Advanced Custom Fields setup if ( function_exists( 'register_field_group' ) && is_admin() ) { require_once( get_template_directory() . '/includes/plugins/advanced-custom-fields/advanced-custom-fields.php' ); } // Beaver Builder setup if ( class_exists( 'FLBuilder' ) ) { require_once( get_template_directory() . '/includes/plugins/beaver-builder/beaver-builder.php' ); } // Jetpack setup if ( class_exists( 'Jetpack' ) ) { require_once( get_template_directory() . '/includes/plugins/jetpack/jetpack.php' ); } // Smart Slider 3 setup if ( class_exists( 'N2SS3' ) ) { require_once( get_template_directory() . '/includes/plugins/smart-slider/smart-slider.php' ); }