本文整理汇总了PHP中add_cssclass函数的典型用法代码示例。如果您正苦于以下问题:PHP add_cssclass函数的具体用法?PHP add_cssclass怎么用?PHP add_cssclass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_cssclass函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_menu_classes
function add_menu_classes($menu)
{
$first = $lastorder = false;
$i = 0;
$mc = count($menu);
foreach ($menu as $order => $top) {
$i++;
if (0 == $order) {
// dashboard is always shown/single
$menu[0][4] = add_cssclass('active', $top[4]);
$lastorder = 0;
continue;
}
if (0 === strpos($top[2], 'separator') && false !== $lastorder) {
// if separator
$first = true;
$c = $menu[$lastorder][4];
$menu[$lastorder][4] = add_cssclass('', $c);
continue;
}
if ($first) {
$c = $menu[$order][4];
$menu[$order][4] = add_cssclass('menu-top-first', $c);
$first = false;
}
if ($mc == $i) {
// last item
$c = $menu[$order][4];
$menu[$order][4] = add_cssclass('menu-top-last', $c);
}
$lastorder = $order;
}
return apply_filters('add_menu_classes', $menu);
}
示例2: add_menu_classes
function add_menu_classes($menu)
{
$first = $lastorder = false;
$i = 0;
$mc = count($menu);
foreach ($menu as $order => $top) {
$i++;
if (0 == $order) {
// dashboard is always shown/single
$menu[0][4] = add_cssclass('menu-top-first', $top[4]);
$lastorder = 0;
continue;
}
if (0 === strpos($top[2], 'separator') && false !== $lastorder) {
// if separator
$first = true;
$c = $menu[$lastorder][4];
$menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
continue;
}
if ($first) {
$c = $menu[$order][4];
$menu[$order][4] = add_cssclass('menu-top-first', $c);
$first = false;
}
if ($mc == $i) {
// last item
$c = $menu[$order][4];
$menu[$order][4] = add_cssclass('menu-top-last', $c);
}
$lastorder = $order;
}
/**
* Filter administration menus array with classes added for top-level items.
*
* @since 2.7.0
*
* @param array $menu Associative array of administration menu items.
*/
return apply_filters('add_menu_classes', $menu);
}
示例3: add_cssclass
<?php
function add_cssclass($add, $class)
{
$class = empty($class) ? $add : ($class .= ' ' . $add);
return $class;
}
add_cssclass('test', $a);