Skip to content

Instantly share code, notes, and snippets.

@tomjn
Created August 24, 2013 13:49
Show Gist options
  • Save tomjn/52b6eb6a340aeeb3e85c to your computer and use it in GitHub Desktop.
Save tomjn/52b6eb6a340aeeb3e85c to your computer and use it in GitHub Desktop.
<?php
function add_menu_item( $name ) {
// stuff...
do_action('item_added');
}
// in another file....
function add_last_item() {
// add a 'last' item
add_item( 'last' );
}
// say we need a 'last' item that we apply css classes to
add_action( 'item_added', 'add_last_item' );
add_menu_item( 'home' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment