/** * Enqueue styles and scripts. * * @since 1.0.0. * * @return void */ function ttfmake_scripts() { // Styles $style_dependencies = array(); // Google fonts if ('' !== ($google_request = ttfmake_get_google_font_uri())) { // Enqueue the fonts wp_enqueue_style('ttfmake-google-fonts', $google_request, $style_dependencies, TTFMAKE_VERSION); $style_dependencies[] = 'ttfmake-google-fonts'; } // Font Awesome wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome' . TTFMAKE_SUFFIX . '.css', $style_dependencies, '4.5.0'); $style_dependencies[] = 'font-awesome'; // Parent stylesheet, if child theme is active // @link http://justintadlock.com/archives/2014/11/03/loading-parent-styles-for-child-themes if (is_child_theme() && defined('TTFMAKE_CHILD_VERSION') && version_compare(TTFMAKE_CHILD_VERSION, '1.1.0', '>=')) { /** * Toggle for loading the parent stylesheet along with the child one. * * @since 1.6.0. * * @param bool $enqueue True enqueues the parent stylesheet. */ if (true === apply_filters('make_enqueue_parent_stylesheet', true)) { wp_enqueue_style('ttfmake-parent-style', get_template_directory_uri() . '/style.css', $style_dependencies, TTFMAKE_VERSION); $style_dependencies[] = 'ttfmake-parent-style'; } } // Main stylesheet wp_enqueue_style('ttfmake-main-style', get_stylesheet_uri(), $style_dependencies, TTFMAKE_VERSION); $style_dependencies[] = 'ttfmake-main-style'; // Print stylesheet wp_enqueue_style('ttfmake-print-style', get_template_directory_uri() . '/css/print.css', $style_dependencies, TTFMAKE_VERSION, 'print'); // Scripts $script_dependencies = array(); // FitVids // Register only. Enqueued when necessary by the embed shortcode. wp_register_script('fitvids', get_template_directory_uri() . '/js/libs/fitvids/jquery.fitvids' . TTFMAKE_SUFFIX . '.js', array('jquery'), '1.1', true); // Cycle2 // Register only. Enqueued when necessary by gallery shortcode or Banner section. ttfmake_cycle2_script_setup(array('jquery')); // jQuery $script_dependencies[] = 'jquery'; // Global script wp_enqueue_script('ttfmake-global', get_template_directory_uri() . '/js/global' . TTFMAKE_SUFFIX . '.js', $script_dependencies, TTFMAKE_VERSION, true); // FitVids selectors $selector_array = array("iframe[src*='www.viddler.com']", "iframe[src*='money.cnn.com']", "iframe[src*='www.educreations.com']", "iframe[src*='//blip.tv']", "iframe[src*='//embed.ted.com']", "iframe[src*='//www.hulu.com']"); /** * Allow for changing of the selectors that are used to apply FitVids. * * @since 1.2.3. * * @param array $selector_array The selectors used by FitVids. */ $selector_array = apply_filters('make_fitvids_custom_selectors', $selector_array); // Compile selectors $fitvids_custom_selectors = array('fitvids' => array('selectors' => implode(',', $selector_array))); // Send to the script wp_localize_script('ttfmake-global', 'ttfmakeGlobal', $fitvids_custom_selectors); // Comment reply script if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * Enqueue styles and scripts. * * @since 1.0.0. * * @return void */ function ttfmake_scripts() { // Styles $style_dependencies = array(); // Google fonts if ('' !== ($google_request = ttfmake_get_google_font_uri())) { // Enqueue the fonts wp_enqueue_style('ttfmake-google-fonts', $google_request, $style_dependencies, TTFMAKE_VERSION); $style_dependencies[] = 'ttfmake-google-fonts'; } // Font Awesome wp_enqueue_style('ttfmake-font-awesome', get_template_directory_uri() . '/css/font-awesome' . TTFMAKE_SUFFIX . '.css', $style_dependencies, '4.2.0'); $style_dependencies[] = 'ttfmake-font-awesome'; // Main stylesheet wp_enqueue_style('ttfmake-main-style', get_stylesheet_uri(), $style_dependencies, TTFMAKE_VERSION); $style_dependencies[] = 'ttfmake-main-style'; // Print stylesheet wp_enqueue_style('ttfmake-print-style', get_template_directory_uri() . '/css/print.css', $style_dependencies, TTFMAKE_VERSION, 'print'); // Scripts $script_dependencies = array(); // jQuery $script_dependencies[] = 'jquery'; // Cycle2 ttfmake_cycle2_script_setup($script_dependencies); $script_dependencies[] = 'ttfmake-cycle2'; // FitVids wp_enqueue_script('ttfmake-fitvids', get_template_directory_uri() . '/js/libs/fitvids/jquery.fitvids' . TTFMAKE_SUFFIX . '.js', $script_dependencies, '1.1', true); // Default selectors $selector_array = array("iframe[src*='www.viddler.com']", "iframe[src*='money.cnn.com']", "iframe[src*='www.educreations.com']", "iframe[src*='//blip.tv']", "iframe[src*='//embed.ted.com']", "iframe[src*='//www.hulu.com']"); /** * Allow for changing of the selectors that are used to apply FitVids. * * @since 1.2.3. * * @param array $selector_array The selectors used by FitVids. */ $selector_array = apply_filters('make_fitvids_custom_selectors', $selector_array); // Compile selectors $fitvids_custom_selectors = array('selectors' => implode(',', $selector_array)); // Send to the script wp_localize_script('ttfmake-fitvids', 'ttfmakeFitVids', $fitvids_custom_selectors); $script_dependencies[] = 'ttfmake-fitvids'; // Global script wp_enqueue_script('ttfmake-global', get_template_directory_uri() . '/js/global' . TTFMAKE_SUFFIX . '.js', $script_dependencies, TTFMAKE_VERSION, true); // Comment reply script if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }