Skip to content

Instantly share code, notes, and snippets.

@tomjn
Created Aug 24, 2013
Embed
What would you like to do?
<?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