__( ' - do not use Google Font', 'wm_domain' ), //Default theme font 'optgroup' . 0 => sprintf( _x( 'Theme default', 'Google Font default setup options group title.', 'wm_domain' ), 1 ), 'Ubuntu:400,300' => 'Ubuntu', '/optgroup' . 0 => '', //Insipration from http://femmebot.github.io/google-type/ 'optgroup' . 1 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 1 ), 'Playfair Display' => 'Playfair Display', 'Fauna One' => 'Fauna One', '/optgroup' . 1 => '', 'optgroup' . 2 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 2 ), 'Fugaz One' => 'Fugaz One', 'Oleo Script' => 'Oleo Script', 'Monda' => 'Monda', '/optgroup' . 2 => '', 'optgroup' . 3 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 3 ), 'Unica One' => 'Unica One', 'Vollkorn' => 'Vollkorn', '/optgroup' . 3 => '', 'optgroup' . 4 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 4 ), 'Megrim' => 'Megrim', 'Roboto Slab:400,300,100' => 'Roboto Slab', '/optgroup' . 4 => '', 'optgroup' . 5 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 5 ), 'Open Sans:400,300' => 'Open Sans', 'Gentium Basic' => 'Gentium Basic', '/optgroup' . 5 => '', 'optgroup' . 6 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 6 ), 'Ovo' => 'Ovo', 'Muli:300,400' => 'Muli', '/optgroup' . 6 => '', 'optgroup' . 7 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 7 ), 'Neuton:200,300,400' => 'Neuton', '/optgroup' . 7 => '', 'optgroup' . 8 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 8 ), 'Quando' => 'Quando', 'Judson' => 'Judson', 'Montserrat' => 'Montserrat', '/optgroup' . 8 => '', 'optgroup' . 9 => sprintf( _x( 'Recommendation #%d', 'Google Font setup recommendation (numbered) group title.', 'wm_domain' ), 9 ), 'Ultra' => 'Ultra', 'Stint Ultra Expanded' => 'Stint Ultra Expanded', 'Slabo 13px' => 'Slabo 13px', '/optgroup' . 9 => '', //Google Fonts selection 'optgroup' . 10 => _x( 'Fonts selection', 'Title for selection of fonts picked from Google Fontss', 'wm_domain' ), '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' . 10 => '', ); //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' => __( 'Sidebar', 'wm_domain' ), 'description' => __( 'Page sidebar.', 'wm_domain' ), ), 'front-page' => array( 'name' => __( 'Front Page Widgets', 'wm_domain' ), 'description' => __( 'This widgets area is displayed below the Banner area on the front page (homepage).', 'wm_domain' ), ), 'footer' => array( 'name' => __( 'Footer Widgets', 'wm_domain' ), 'description' => __( 'Masonry layout is used to display footer widgets.', 'wm_domain' ), ), ); //Output $output = apply_filters( 'wmhook_wm_helper_var_output', $output ); if ( isset( $output[ $variable ] ) ) { $output = $output[ $variable ]; if ( isset( $output[ $key ] ) ) { $output = $output[ $key ]; } } else { $output = ''; } return $output; } } // /wm_helper_var /** * 30) Theme setup */ /** * Theme setup * * @since 1.0 * @version 1.2 */ if ( ! function_exists( 'wm_setup' ) ) { function wm_setup() { //Helper variables global $content_width; //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( array( 'Ubuntu:400,300' ) ) ), add_query_arg( array( 'ver' => WM_THEME_VERSION ), wm_get_stylesheet_directory_uri( 'genericons/genericons.css' ) ), add_query_arg( array( 'ver' => WM_THEME_VERSION ), wm_get_stylesheet_directory_uri( 'css/editor-style.css' ) ), ) ) ); /** * 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( 'wm_domain', trailingslashit( WP_LANG_DIR ) . 'themes/' . WM_THEME_SHORTNAME ); //wp-content/themes/child-theme-name/languages/it_IT.mo load_theme_textdomain( 'wm_domain', get_stylesheet_directory() . '/languages' ); //wp-content/themes/theme-name/languages/it_IT.mo load_theme_textdomain( 'wm_domain', get_template_directory() . '/languages' ); //Title tag add_theme_support( 'title-tag' ); //Visual editor styles add_editor_style( $visual_editor_css ); //Feed links add_theme_support( 'automatic-feed-links' ); //Enable HTML5 markup add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', ) ); //Custom menus add_theme_support( 'menus' ); register_nav_menus( apply_filters( 'wmhook_wm_setup_menus', array( 'primary' => __( 'Primary Menu', 'wm_domain' ), 'social' => __( 'Social Links Menu', 'wm_domain' ), ) ) ); //Custom header add_theme_support( 'custom-header', apply_filters( 'wmhook_wm_setup_custom_background_args', array( 'default-image' => wm_get_stylesheet_directory_uri( 'images/header.jpg' ), 'header-text' => false, 'width' => 1640, 'height' => 686, 'flex-height' => false, 'flex-width' => false, ) ) ); //Custom background add_theme_support( 'custom-background', apply_filters( 'wmhook_wm_setup_custom_background_args', array( 'default-color' => 'eaecee', ) ) ); //Thumbnails support add_post_type_support( 'attachment:audio', 'thumbnail' ); add_post_type_support( 'attachment:video', 'thumbnail' ); add_theme_support( 'post-thumbnails', array( 'attachment:audio', 'attachment:video' ) ); add_theme_support( 'post-thumbnails' ); //Image sizes (x, y, crop) add_image_size( 'banner', 1640, 686, true ); //@link http://en.wikipedia.org/wiki/Anamorphic_format add_image_size( 'banner-small', absint( $content_width ), absint( $content_width / 2.39 ), true ); //@link http://en.wikipedia.org/wiki/Anamorphic_format //Set default WordPress image sizes $default_image_sizes = apply_filters( 'wmhook_wm_setup_default_image_sizes', array( 'thumbnail' => array( 420, 280, true ), //Posts list thumbnails 'medium' => array( absint( $content_width * .62 ), 9999, false ), //Content width image 'large' => array( absint( $content_width ), 9999, false ), //Single post featured image ) ); foreach ( $default_image_sizes as $size => $setup ) { if ( $default_image_sizes[ $size ][0] != get_option( $size . '_size_w' ) ) { update_option( $size . '_size_w', $default_image_sizes[ $size ][0] ); } if ( $default_image_sizes[ $size ][1] != get_option( $size . '_size_h' ) ) { update_option( $size . '_size_h', $default_image_sizes[ $size ][1] ); } if ( $default_image_sizes[ $size ][2] != get_option( $size . '_crop' ) ) { update_option( $size . '_crop', $default_image_sizes[ $size ][2] ); } } } } // /wm_setup /** * 40) Assets and design */ /** * Registering theme styles and scripts * * @since 1.0 * @version 1.3 */ if ( ! function_exists( 'wm_register_assets' ) ) { function wm_register_assets() { /** * Styles */ $register_styles = apply_filters( 'wmhook_wm_register_assets_register_styles', array( 'wm-customizer' => array( get_template_directory_uri() . '/css/customizer.css' ), 'wm-genericons' => array( wm_get_stylesheet_directory_uri( 'genericons/genericons.css' ) ), 'wm-google-fonts' => array( wm_google_fonts_url( array( 'Ubuntu:400,300' ) ) ), 'wm-starter' => array( wm_get_stylesheet_directory_uri( 'css/starter.css' ) ), 'wm-stylesheet' => array( 'src' => get_stylesheet_uri(), 'deps' => array( 'wm-genericons', 'wm-starter' ) ), 'wm-colors' => array( wm_get_stylesheet_directory_uri( 'css/colors.css' ), 'deps' => array( 'wm-stylesheet' ) ), 'wm-slick' => array( wm_get_stylesheet_directory_uri( 'css/slick.css' ) ), ) ); foreach ( $register_styles as $handle => $atts ) { $src = ( isset( $atts['src'] ) ) ? ( $atts['src'] ) : ( $atts[0] ); $deps = ( isset( $atts['deps'] ) ) ? ( $atts['deps'] ) : ( false ); $ver = ( isset( $atts['ver'] ) ) ? ( $atts['ver'] ) : ( WM_SCRIPTS_VERSION ); $media = ( isset( $atts['media'] ) ) ? ( $atts['media'] ) : ( 'all' ); wp_register_style( $handle, $src, $deps, $ver, $media ); } /** * Scripts */ $register_scripts = apply_filters( 'wmhook_wm_register_assets_register_scripts', array( 'wm-customizer-preview' => array( 'src' => wm_get_stylesheet_directory_uri( 'js/customizer-preview.js' ), 'deps' => array( 'customizer-preview' ) ), 'wm-imagesloaded' => array( wm_get_stylesheet_directory_uri( 'js/imagesloaded.pkgd.min.js' ) ), 'wm-slick' => array( 'src' => wm_get_stylesheet_directory_uri( 'js/slick.min.js' ), 'deps' => array( 'jquery' ) ), 'wm-theme-scripts' => array( 'src' => wm_get_stylesheet_directory_uri( 'js/scripts.js' ), 'deps' => array( 'jquery', 'wm-imagesloaded' ) ), 'wm-skip-link-focus-fix' => array( wm_get_stylesheet_directory_uri( 'js/skip-link-focus-fix.js' ) ), ) ); foreach ( $register_scripts as $handle => $atts ) { $src = ( isset( $atts['src'] ) ) ? ( $atts['src'] ) : ( $atts[0] ); $deps = ( isset( $atts['deps'] ) ) ? ( $atts['deps'] ) : ( false ); $ver = ( isset( $atts['ver'] ) ) ? ( $atts['ver'] ) : ( WM_SCRIPTS_VERSION ); $in_footer = ( isset( $atts['in_footer'] ) ) ? ( $atts['in_footer'] ) : ( true ); wp_register_script( $handle, $src, $deps, $ver, $in_footer ); } } } // /wm_register_assets /** * Frontend HTML head assets enqueue * * @since 1.0 * @version 1.3 */ if ( ! function_exists( 'wm_enqueue_assets' ) ) { function wm_enqueue_assets() { //Helper variables $enqueue_styles = $enqueue_scripts = array(); $custom_styles = wm_custom_styles(); $inline_styles_handle = ( wp_style_is( 'wm-colors', 'registered' ) ) ? ( 'wm-colors' ) : ( 'wm-stylesheet' ); $inline_styles_handle = apply_filters( 'wmhook_wm_enqueue_assets_inline_styles_handle', $inline_styles_handle ); /** * Styles */ //Google Fonts if ( wm_google_fonts_url( array( 'Ubuntu:400,300' ) ) ) { $enqueue_styles[] = 'wm-google-fonts'; } //Food menu icon for search results if ( ( is_search() || is_archive() ) && defined( 'JETPACK__VERSION' ) && class_exists( 'Nova_Restaurant' ) ) { wp_enqueue_style( 'nova-font', plugins_url( 'css/nova-font.css', JETPACK__PLUGIN_DIR . 'modules/custom-post-types/nova.php' ), array(), JETPACK__VERSION ); } //Banner slider if ( is_front_page() && wm_has_banner_posts( 2 ) ) { $enqueue_styles[] = 'wm-slick'; } //Main $enqueue_styles[] = 'wm-stylesheet'; //Colors if ( 'wm-colors' === $inline_styles_handle ) { $enqueue_styles[] = 'wm-colors'; } $enqueue_styles = apply_filters( 'wmhook_wm_enqueue_assets_enqueue_styles', $enqueue_styles ); foreach ( $enqueue_styles as $handle ) { wp_enqueue_style( $handle ); } /** * Styles - inline */ //Customizer setup custom styles if ( $custom_styles ) { wp_add_inline_style( $inline_styles_handle, "\r\n" . apply_filters( 'wmhook_esc_css', $custom_styles ) . "\r\n" ); } //Custom styles set in post/page 'custom-css' custom field if ( is_singular() && $output = get_post_meta( get_the_ID(), 'custom_css', true ) ) { $output = apply_filters( 'wmhook_wm_enqueue_assets_styles_inline_singular', "\r\n\r\n/* Custom singular styles */\r\n" . $output . "\r\n" ); wp_add_inline_style( $inline_styles_handle, apply_filters( 'wmhook_esc_css', $output ) . "\r\n" ); } //Beaver Builder support if ( isset( $_GET['fl_builder'] ) ) { $output = apply_filters( 'wmhook_wm_enqueue_assets_styles_inline_beaver_builder', "\r\n.fl-builder-lightbox .fl-lightbox { width: 720px; } .fl-builder-settings-tab { width: 100%; }\r\n" ); wp_add_inline_style( $inline_styles_handle, apply_filters( 'wmhook_esc_css', $output ) . "\r\n" ); } /** * Scripts */ //Masonry script (in footer and in archives) $footer_widgets = wp_get_sidebars_widgets(); if ( ( is_array( $footer_widgets ) && isset( $footer_widgets['footer'] ) && count( $footer_widgets['footer'] ) > absint( apply_filters( 'wmhook_widgets_columns', 3, 'footer' ) ) ) || ( is_archive() && ! is_tax( 'nova_menu' ) ) || is_front_page() || is_home() || is_search() ) { $enqueue_scripts[] = 'jquery-masonry'; } //Banner slider if ( is_front_page() && wm_has_banner_posts( 2 ) ) { $enqueue_scripts[] = 'wm-slick'; } //Global theme scripts $enqueue_scripts[] = 'wm-theme-scripts'; //Skip link focus fix $enqueue_scripts[] = 'wm-skip-link-focus-fix'; $enqueue_scripts = apply_filters( 'wmhook_wm_enqueue_assets_enqueue_scripts', $enqueue_scripts ); foreach ( $enqueue_scripts as $handle ) { wp_enqueue_script( $handle ); } //Put comments reply scripts into footer if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply', false, false, false, true ); } /** * Scripts - inline */ $scripts_inline = apply_filters( 'wmhook_wm_enqueue_assets_scripts_inline', array( 'text_menu_group_nav' => _x( '↑ Menu sections', 'Back to food menu sections selectors button title.', 'wm_domain' ) ) ); wp_localize_script( 'wm-theme-scripts', '$scriptsInline', $scripts_inline ); } } // /wm_enqueue_assets /** * HTML Body classes * * @since 1.0 * @version 1.3 * * @param array $classes */ if ( ! function_exists( 'wm_body_classes' ) ) { function wm_body_classes( $classes ) { //Helper variables $body_classes = array(); //Preparing output //Is not front page? if ( ! is_front_page() ) { $body_classes[0] = 'not-front-page'; } //Singular? if ( is_singular() ) { $body_classes[10] = 'is-singular'; } //Has featured image? if ( is_singular() && has_post_thumbnail() ) { $body_classes[20] = 'has-post-thumbnail'; } //Is posts list? if ( is_archive() || is_search() ) { $body_classes[30] = 'is-posts-list'; } //Output $body_classes = array_filter( (array) apply_filters( 'wmhook_wm_body_classes_output', $body_classes ) ); $classes = array_merge( $classes, $body_classes ); asort( $classes ); return $classes; } } // /wm_body_classes /** * Add featured image as background image to post navs * * @since 1.0 * @version 1.3 */ if ( ! function_exists( 'wm_post_nav_background' ) ) { function wm_post_nav_background() { //Requrements check if ( ! is_single() ) { return; } //Helper variables $output = ''; $previous = ( is_attachment() ) ? ( get_post( get_post()->post_parent ) ) : ( get_adjacent_post( false, '', true ) ); $next = get_adjacent_post( false, '', false ); if ( is_attachment() && 'attachment' == $previous->post_type ) { return; } //Preparing output if ( $previous && has_post_thumbnail( $previous->ID ) ) { $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'banner-small' ); $output .= '.post-navigation .nav-previous { background-image: url(\'' . esc_url( $prevthumb[0] ) . '\'); }'; } if ( $next && has_post_thumbnail( $next->ID ) ) { $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'banner-small' ); $output .= '.post-navigation .nav-next { background-image: url(\'' . esc_url( $nextthumb[0] ) . '\'); }'; } $output = apply_filters( 'wmhook_wm_post_nav_background_output', $output ); //Output wp_add_inline_style( 'wm-stylesheet', apply_filters( 'wmhook_esc_css', $output ) . "\r\n" ); } } // /wm_post_nav_background /** * 50) Site global markup */ /** * Website DOCTYPE * * @since 1.0 * @version 1.2 */ if ( ! function_exists( 'wm_doctype' ) ) { function wm_doctype() { echo ''; } } // /wm_doctype /** * Website HEAD */ if ( ! function_exists( 'wm_head' ) ) { function wm_head() { //Helper variables $output = array(); //Preparing output $output[10] = ''; $output[20] = ''; $output[30] = ''; $output[40] = ''; //Filter output array $output = apply_filters( 'wmhook_wm_head_output_array', $output ); //Output echo apply_filters( 'wmhook_wm_head_output', implode( "\r\n", $output ) . "\r\n" ); } } // /wm_head /** * Body top * * @since 1.0 * @version 1.2 */ if ( ! function_exists( 'wm_site_top' ) ) { function wm_site_top() { //Helper variables $output = '
' . get_the_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( __( 'Continue reading%s…', 'wm_domain' ), ' "' . get_the_title() . '"' ) . ''; } } // /wm_excerpt_continue_reading /** * Previous and next post links * * Since WordPress 4.1 you can use the_post_navigation() and/or get_the_post_navigation(). * However, you are modifying markup by applying custom classes, so stick with this * cusotm function for now. * * @todo Transfer to WordPress 4.1+ core functionality. * * @since 1.0 * @version 1.1 */ if ( ! function_exists( 'wm_post_nav' ) ) { function wm_post_nav() { //Requirements check if ( ! is_singular() || is_page() ) { return; } //Helper variables $output = $prev_class = $next_class = ''; $previous = ( is_attachment() ) ? ( get_post( get_post()->post_parent ) ) : ( get_adjacent_post( false, '', true ) ); $next = get_adjacent_post( false, '', false ); //Requirements check if ( ( ! $next && ! $previous ) || ( is_attachment() && 'attachment' == $previous->post_type ) ) { return; } //Preparing output if ( $previous && has_post_thumbnail( $previous->ID ) ) { $prev_class = " has-post-thumbnail"; } if ( $next && has_post_thumbnail( $next->ID ) ) { $next_class = " has-post-thumbnail"; } if ( is_attachment() ) { $output .= get_previous_post_link( '
', __( ' %title', 'wm_domain' ) ); } else { $output .= get_previous_post_link( '', __( ' %title', 'wm_domain' ) ); $output .= get_next_post_link( '', __( ' %title', 'wm_domain' ) ); } if ( $output ) { $output = ''; } //Output echo apply_filters( 'wmhook_wm_post_nav_output', $output ); } } // /wm_post_nav /** * Pagination */ if ( ! function_exists( 'wm_pagination' ) ) { function wm_pagination() { //Requirements check if ( class_exists( 'The_Neverending_Home_Page' ) ) { //Don't display pagination if Jetpack Infinite Scroll in use return; } //Helper variables global $wp_query, $wp_rewrite; $output = ''; $pagination = array( 'base' => @add_query_arg( 'paged', '%#%' ), 'format' => '', 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query->max_num_pages, 'prev_text' => '«', 'next_text' => '»', ); //Preparing output if ( $output = paginate_links( $pagination ) ) { $output = '