-2
私はワードプレスのウェブサイトを持っており、buddypressにいくつかの変更を実装しようとしています。 メインメニューの通知を表示するのに成功しましたが、カウントが0より大きい場合は色を変更したいと考えています。カウントが0(PHP)より大きい場合、クラスを変更するにはどうすればよいですか?
So:値(多分$ notif?)が0より大きい場合クラス「ペンディングカウント」を「ペンディングカウントアラート」に変更する必要があります...
私にお手伝いできる場合は....事前に感謝!
<?php
function my_nav_menu_notif_counter($menu) {
if (!is_user_logged_in())
return $menu;
else
$notif = '<li ><a class="ab-item" href="' . bp_core_get_user_domain(bp_loggedin_user_id()) . 'notifications/">'. __('').'<span id="ab-pending-notifications" class="pending-count alert">'. __(''). bp_notifications_get_unread_notification_count(bp_loggedin_user_id()) .'</span> </a></li>';
$menu = $menu . $notif;
return $menu;
}
add_filter('wp_nav_menu_items', 'my_nav_menu_notif_counter');
add_filter('show_admin_bar', '__return_false');
?>