Please or Register to create posts and topics.

Problem adding new menu links to the existing Forum menu

Hi there,

First I want to thank you for the wonderful plugin, I’ve tested a couple and that last Forum plugin “WPFORO” wasn’t mobile friendly and the support staff never had answers to my questions so I ended up deactivating that plugin.

So my question is how to format and wrap the additional menu items where they are formatted properly on the Desktop this is the current code I have in my theme functions file:

The closest I got to making it wrap in any type of format was using a pipe(|) and that shows up in the menu, and I am not that good at PHP coding.

Also, I have attached a screen shot of my customized menu.

PS: I removed the links to my website to keep it from showing up on google search and replaced it with https://example.com.

function my_menu() {

echo   '<a href="https://example.com" class="center">Friends&nbsp;&nbsp</a>';

echo   '<a href="https://example.com" class="center">Alerts&nbsp;&nbsp</a>';

echo '<a href="https://example.com" class="center">|Classifieds&nbsp;&nbsp</a>';

echo '<a href="https://example.com">Listings&nbsp</a>';

echo '<a href="https://example.com">Chat&nbsp</a>';

echo '<a href="https://example.com">Messages&nbsp</a>';

echo '<a href="https://example.com">Reviews&nbsp</a>';

echo '<a href="https://example.com">Testimonials&nbsp</a>';

echo '<a href="https://example.com">News&nbsp</a>';

echo '<a href="https://example.com">Google&nbsp</a>'; 

}

add_action('asgarosforum_custom_header_menu', 'my_menu');

Thanks a bunch

Naomi

Uploaded files:
  • A_Menu.png

Hello @naomibuch

Thanks for the screenshot! This post helps me more than the one in the official WordPress forums. 🙂

So basically you want that those links break down next to the search-input without an additional line-break, right?

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hi there again,

Thanks so much for getting back to me, I put my programming skills to use(VB.Net/SQL for 18 years) but forced to learn PHP …lol.

Anyway I got the code to work by replacing the pipe(|) with <br> to wrap the menu items and put extra logic in the code to hide the custom menu items if the user is not logged in, I will share my code in the event it will help others.

I provided screenshots of the menu logged in and logged out below:

Thanks again for your help.

Naomi

 

function my_menu() {

if (is_user_logged_in())
echo ‘<a href=”https://www.example.com/listing-form” class=”center”>Classifieds</a>’;

else
return array (”, wp_login_url());

echo ‘<a href=”https://www.example.com/talk-buzz-members/” class=”center”>Friends<br>’;

echo ‘<a href=”https://www.example.com/talk-buzz-members/me/friends/requests” class=”center”>Alerts</a>’;

echo ‘<a href=”https://www.example.com/listings” class=”center”>Listings</a>’;

echo ‘<a href=”https://www.example.com/messages” class=”center”>Messages</a>’;

if (is_user_logged_in())
echo ‘<a href=”https://www.example.com/” class=”center”>Talk</a>’;

else
return array (”, wp_login_url());

echo ‘<a href=”https://www.example.com/google-news” class=”center”>News</a>’;

echo ‘<a href=”https://www.example.com/google” class=”center”>Google</a>’;

echo ‘<a href=”https://www.example.com/testimonials”class=”center”>Testimonials</a>’;

if (is_user_logged_in())
echo ‘<a href=”https://www.example.com/talk-buzz-reviews” class=”center”>Reviews</a>’;

return array (”, wp_login_url());

}

add_action(‘asgarosforum_custom_header_menu’, ‘my_menu’);

 

 

Uploaded files:
  • A_Menu3.png
  • A_Menu4.png
Asgaros has reacted to this post.
Asgaros

@naomibuch where you put to this code???

here is screen shot for more….
Uploaded files:
  • A_Menu3.png

Hello @hafizmorsalin

You can change this URLs directly in the settings: Forum -> Settings -> URLs.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!