I have this add_filter code.
add_filter( 'wp_nav_menu_objects', function ($items, $args) {
$request_item = NULL;
foreach ($items as $item ) {
if ('/request/' == $item->url)
$request_item = $item;
}
if ($request_item) {
if (ubitto_has_request_answer_permission()) {
$user_id = get_current_user_id();
global $wpdb;
$count = $wpdb->get_var("select count(1) from {$wpdb->prefix}ub_request r inner join {$wpdb->prefix}posts p on r.topic_id = p.ID where r.end_date is null and
(r.coupon_id is null or exists(select 1 from {$wpdb->prefix}ub_coupon c where c.id = r.coupon_id and c.type = 'request' and c.author_id = {$user_id}))");
$request_item->title = "Learners' requests - $count";
} else {
$request_item->title = "My requests";
}
}
return $items;
}, 10, 2);
I hope to apply a class='count' on the value of $count above...
[
Do you have any idea how to achieve this? I have super basic code understanding.
I already have the css ready
Thank you