ThemeShaper Forums » Thematic

[closed]

How to Combine the Superfish scripts

(2 posts)
  • Started 6 years ago by helgatheviking
  • Latest reply from helgatheviking
  • This topic is not a support question
  1. for anyone who is interested, i merged the 4 files required for thematic's superfish menus into 1 file- with the goal of reducing the number of external page requests when trying to speed up your site

    http://pastebin.com/D5p7k0Dj

    to use it you'd get rid of how thematic currently adds their scripts

    // Filter away the default scripts loaded with Thematic
    function childtheme_head_scripts() {
        // Abscence makes the heart grow fonder
    }
    add_filter('thematic_head_scripts','childtheme_head_scripts');

    i'm not sure WHY thematic isn't enqueing these. gene, if you're around, what is up w/ that?

    and replace it with

    function enqueue_dropdowns(){
    	wp_enqueue_script('superfish',JS . 'thematic-combined.js',array('jquery');
    }
    add_action('wp_enqueue_scripts','enqueue_dropdowns');

    where JS is the constant I have defined for where I store my scripts

    define('CHILDTHEME', get_bloginfo('stylesheet_directory') . '/');
    define('JS', CHILDTHEME . 'js/');

    Posted 6 years ago #
  2. typo in my second bit o' code

    //replace with combined, minified and properly enqueued
    function enqueue_dropdowns(){
    	wp_enqueue_script('superfish',JS . 'thematic-combined.js',array('jquery'));
    }
    add_action('wp_enqueue_scripts','enqueue_dropdowns');
    Posted 6 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.