I had cobbled together a quick plugin to play with the $menuitems variable. This plugin turns the linst items into an array, then adds entries into the array. Consider it a starting point for anyone who wants to write a "custom menu link" plugin.
-Rob A>
Code:
<?php
/*
Plugin Name: Menu Modify
Description: Modifies the Menu
Version: 0.1
Author: Rob Antonishen
Author URI: http://ffaat.pointclark.net
*/
# get correct id for plugin
$thisfile=basename(__FILE__, ".php");
# register plugin
register_plugin(
$thisfile,
'Menu Modify',
'0.1',
'Rob Antonishen',
'http://ffaat.pointclark.net',
'Modifies the menu',
'theme',
'menu_show'
);
# activate filter
add_filter('menuitems','menu_filter');
function menu_show() {}
function menu_filter($menuitems) {
preg_match_all("/<li(.*)?>(.*?)<\/li>/",$menuitems,$menuarray);
#insert at start
#array_splice($menuarray[0],0,0,'<li><a href="http://something.com" title="New Menu Item">New Item</a></li>');
#insert at end
array_splice($menuarray[0],count($menuarray[0]),0,'<li><a href="http://www.google.com" title="Google">Google</a></li>');
$menuitems = implode($menuarray[0]);
return $menuitems;
}
?>
-Rob A>