ThemeShaper Forums » Thematic

how to customize the superfish menu in 0.9

(6 posts)
  • Started 11 years ago by dwenaus
  • Latest reply from Chris
  • This topic is resolved
  1. hey guys. kudos on an excellent job integrating the great superfish menu into 0.9.

    I'd like to be able to change the default values for the menu. I see the function thematic_head_scripts is being inserted via add_action('wp_head','thematic_head_scripts') in launcher.php. Should I simply add another add_action with my own script to override it?

    is there a better way? Should we make some variables or add some actions to the superfish code so it is changeable.

    thanks!

    Posted 11 years ago #
  2. Make sure you're using the latest trunk version (launcher's gone), copy the existing function, rename it in your Child Theme functions.php and filter the original.

    I might make the individual scripts that're loaded filterable. I haven't decided yet (maybe for version 1).

    Posted 11 years ago #
  3. thanks, it worked great. I've never worked with removing filters before. it worked perfectly.

    I just copied the suckerfish menu function into my own functions.php, renamed it, then removed the first filter with

    remove_action('wp_head','thematic_head_scripts');

    and hooked my own in:
    add_action('wp_head','thematic_head_scripts_changed');

    maybe in the new child theme template in .9 you could make a simple example of this so people can look in functions.php and understand what's going on. and add lots of comments. :)

    also, with the new child theme, it might be helpful for people if you make a few common changes to the css, such as adding a top image, or changing some colors, using a diff layout, etc. so people can get the gist of what is possible with a few lines of css.

    thanks.

    Posted 11 years ago #
  4. well actually removing an action is not as simple as it looks. I had to run another add_action on the init to remove the action. whew.

    add_action( 'init', create_function( '$a', "remove_action( 'wp_head', 'thematic_head_scripts' );" ) );

    the fun and funky create_function allows you to do it all on one line.

    Is this the only way to do this? or is there a simpler way?

    Posted 11 years ago #
  5. I also just discovered that to remove theme actions that are sub actions of thematic, ie. they hook into the thematic structure such as thematic_header rather then wp_head. you need to call the remove action and make the priority IDENTICAL to the original.

    this works:
    remove_action( 'thematic_header', 'thematic_access', 9 );
    but this won't:
    remove_action( 'thematic_header', 'thematic_access', 10 );
    or any other number for that matter.

    Posted 11 years ago #
  6. There are some question marks floating around here :-)

    Ok .. let me explain the deal with:
    add_action( 'init', create_function( '$a', "remove_action( 'wp_head', 'thematic_head_scripts' );" ) );
    This has something to to with the way WordPress loads certain things. Trying to do a simple remove_action() on an action added to a hook within your theme would try to remove it before it is added. So the workaround waits 'til everything is added and then removes it.

    The Priority thing:
    Using the priority will ensure that WP works through the actions in a certain order.

    Without setting the priority it still works the same way but you wouldn't be able to exchange for instance the third predefined action against your own action without removing all actions down to and including the third one and register your own action plus re-register the rest.

    Using the priority setting you can remove the third action and register your own action with priority 3 or whatever without destroying the order.

    Hope this helps :-)

    Cheers,

    Chris

    Posted 11 years ago #

RSS feed for this topic

Reply

You must log in to post.