Site logo

Archived topic

Adding elements to a Sub Nav Element

22 replies · Started by Carsten on April 19, 2020

Viewing posts 16–23 of 23

Ohh, what a bummer, sorry about that, the message link is displayed now. Thank you very much.

The only thing missing is the message count, apperantly this part of the code, does not work.
<span class="count"></span>

https://imgur.com/kNwEgu2

The question is, if this is possible to achieve?

How is the count populated? Right now it's just an empty element, so nothing will show. You would need to add a value in there for it to display.

Hi there, I've got this information from a developer, but I don't know how to add the user id to the function, can you help?

<?php echo bp_get_total_unread_messages_count( $user_id );?>

User id:

bp_loggedin_user_id(); // of the logged in user
bp_displayed_user_id(); // of the displayed user
bp_get_member_user_id();// in members loop

You would have to put one of those functions in place of the $user_id variable in the first line.

Not sure which one, as I'm not familiar with the functions themselves.

Thanks a lot for your help, the counter is working now.

The problem now is, how I integrate the counter with the menu item into one button?

https://imgur.com/G94fuVP

Here is the markup:

<div class="grid-container sub-navigation grid-parent">
    <ul>
        <li id="messages-personal-li" >
            <a href="https://domain/members/me/messages/" id="user-messages" class="menu-item menu-item-type-post_type menu-item-object-post messages-personal-li button">
        Beskeder <span class="count"></span>
            </a>
        </li>
    </ul>
</div>

<?php echo bp_get_total_unread_messages_count( bp_loggedin_user_id() );?>

I want to add a search page with Page id 31017 to the secondary menu as well.

How do I add a page link, by URL or by page ID?

Thanks

If you have the URL, I would add it by URL so it's more human-friendly :)

This archived topic is closed to new replies.