add leftmenu

This commit is contained in:
arlemp@selectel.ru
2021-11-16 01:46:43 +03:00
parent fc91944876
commit a129c2f92e
32 changed files with 356 additions and 9 deletions

View File

@@ -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;
}