$gfont ) { if ( strpos( $gfont, "&" ) !== false ): wp_enqueue_style( 'esotera-googlefont' . $i, '//fonts.googleapis.com/css?family=' . $gfont, null, _CRYOUT_THEME_VERSION ); unset( $gfonts[$i] ); unset( $roots[$i] ); endif; }; // Merged google fonts if ( !empty($gfonts) ){ wp_enqueue_style( 'esotera-googlefonts', '//fonts.googleapis.com/css?family=' . implode( "|" , array_unique( array_merge( $roots, $gfonts ) ) ), null, _CRYOUT_THEME_VERSION ); }; // Main theme style wp_enqueue_style( 'esotera-main', get_stylesheet_uri(), null, _CRYOUT_THEME_VERSION ); // RTL style if ( is_RTL() ) wp_enqueue_style( 'esotera-rtl', get_template_directory_uri() . '/resources/styles/rtl.css', null, _CRYOUT_THEME_VERSION ); // Theme generated style wp_add_inline_style( 'esotera-main', preg_replace( "/[\n\r\t\s]+/", " ", esotera_custom_styles() ) ); // includes/custom-styles.php } // esotera_enqueue_styles add_action( 'wp_enqueue_scripts', 'esotera_enqueue_styles' ); /* Outputs the author meta link in header */ function esotera_author_link() { global $post; if ( is_single() && get_the_author_meta( 'user_url', $post->post_author ) ) { echo ''; } } //esotera_author_link() add_action ( 'wp_head', 'esotera_author_link' ); /** * Main theme scripts */ function esotera_scripts_method() { // Boxes aspect ratio list( $lpboxheight1, $lpboxwidth1, $lpboxheight2, $lpboxwidth2, ) = array_values( cryout_get_option( array( 'theme_lpboxheight1', 'theme_lpboxwidth1', 'theme_lpboxheight2', 'theme_lpboxwidth2', ) ) ); // Failsafes if ( empty( $lpboxheight1 ) ) $lpboxheight1 = 1; if ( empty( $lpboxheight2 ) ) $lpboxheight2 = 1; $js_options = apply_filters( 'esotera_js_options', array( 'masonry' => cryout_get_option('theme_masonry'), 'rtl' => ( is_rtl() ? true : false ), 'magazine' => cryout_get_option('theme_magazinelayout'), 'fitvids' => cryout_get_option('theme_fitvids'), 'autoscroll' => cryout_get_option('theme_autoscroll'), 'articleanimation' => cryout_get_option('theme_articleanimation'), 'lpboxratios' => array( round( $lpboxwidth1/$lpboxheight1, 3 ), round( $lpboxwidth2/$lpboxheight2, 3 ) ), 'is_mobile' => ( wp_is_mobile() ? true : false ), 'menustyle' => cryout_get_option('theme_menustyle'), ) ); wp_enqueue_script( 'esotera-frontend', get_template_directory_uri() . '/resources/js/frontend.js', array( 'jquery' ), _CRYOUT_THEME_VERSION ); wp_localize_script( 'esotera-frontend', 'cryout_theme_settings', $js_options ); if ($js_options['masonry']) wp_enqueue_script( 'jquery-masonry' ); if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } //esotera_scripts_method() add_action( 'wp_footer', 'esotera_scripts_method' ); /** * Add defer/sync to scripts */ function esotera_scripts_filter($tag) { $defer = cryout_get_option('theme_defer'); $scripts_to_defer = array( 'frontend.js', 'masonry.min.js' ); foreach( $scripts_to_defer as $defer_script ) { if( (true == strpos( $tag, $defer_script )) && $defer ) return str_replace( ' src', ' defer src', $tag ); // ' async defer src' causes issues with masonry } return $tag; } //esotera_scripts_filter() if ( ! is_admin() ) add_filter( 'script_loader_tag', 'esotera_scripts_filter', 10, 2 ); /** * Add responsive meta */ function esotera_responsive_meta() { echo '' . PHP_EOL; echo ''; } //esotera_responsive_meta() add_action( 'cryout_meta_hook', 'esotera_responsive_meta' ); /* * esotera_editor_styles() is located in custom-styles.php */ function esotera_add_editor_styles() { $editorstyles = cryout_get_option('theme_editorstyles'); if ( ! $editorstyles ) return; add_editor_style( 'resources/styles/editor-style.css' ); add_editor_style( add_query_arg( 'action', 'theme_editor_styles_output', admin_url( 'admin-ajax.php' ) ) ); add_action( 'wp_ajax_theme_editor_styles_output', 'esotera_editor_styles_output' ); }//esotera_add_editor_styles esotera_add_editor_styles(); /* FIN */