add leftmenu
This commit is contained in:
@@ -378,4 +378,38 @@ function str_to_in($items){
|
||||
|
||||
return $in;
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_filter( 'nav_menu_item_title', 'filter_nav_menu_item_title', 10, 4 );
|
||||
function filter_nav_menu_item_title( $title, $item, $args, $depth ) {
|
||||
|
||||
$iconpath = TEMPLATEPATH.'/pub/menu/';
|
||||
|
||||
$cstart = false;
|
||||
$cend = false;
|
||||
|
||||
$cstart = strpos($title, '<!--');
|
||||
if ($cstart !== false){
|
||||
$start = $cstart + 4;
|
||||
$cend = strpos($title, '-->', $start + 1);
|
||||
|
||||
if ($cend !== false){
|
||||
$svg = substr($title, $start, $cend - $start);
|
||||
$svgfile = $iconpath.$svg.'.svg';
|
||||
$svgcontent = file_get_contents( $svgfile);
|
||||
|
||||
if (file_exists( $svgfile )){
|
||||
$result = str_replace("<!--$svg-->", $svgcontent , $title);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
Reference in New Issue
Block a user