/**
  * Append the editor styles to the section editors.
  *
  * Unfortunately, the `wp_editor()` function does not support a "content_css" argument. As a result, the stylesheet
  * for the "content_css" parameter needs to be added via a filter.
  *
  * @since  1.0.0.
  *
  * @param  array     $mce_init     The array of tinyMCE settings.
  * @param  string    $editor_id    The ID for the current editor.
  * @return array                   The modified settings.
  */
 function tiny_mce_before_init($mce_init, $editor_id)
 {
     // Only add stylesheet to a section editor
     if (false === strpos($editor_id, 'make')) {
         return $mce_init;
     }
     // Editor styles
     $editor_styles = array();
     if ('' !== ($google_request = ttfmake_get_google_font_uri())) {
         $editor_styles[] = $google_request;
     }
     $editor_styles[] = get_template_directory_uri() . '/css/font-awesome.css';
     $editor_styles[] = get_template_directory_uri() . '/css/editor-style.css';
     // Append in the customizer styles if available
     if (function_exists('ttfmake_get_css') && ttfmake_get_css()->build()) {
         $editor_styles[] = add_query_arg('action', 'ttfmake-css', admin_url('admin-ajax.php'));
     }
     // Create string of CSS files
     $content_css = implode(',', $editor_styles);
     // If there is already a stylesheet being added, append and do not override
     if (isset($mce_init['content_css'])) {
         $mce_init['content_css'] .= ',' . $content_css;
     } else {
         $mce_init['content_css'] = $content_css;
     }
     return $mce_init;
 }
Esempio n. 2
0
 /**
  * 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');
     }
 }
Esempio n. 3
0
 /**
  * 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');
     }
 }