Problem adding new menu links to the existing Forum menu
Quote from naomibuch on September 16, 2019, 1:30 pmHi 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  </a>'; echo '<a href="https://example.com" class="center">Alerts  </a>'; echo '<a href="https://example.com" class="center">|Classifieds  </a>'; echo '<a href="https://example.com">Listings </a>'; echo '<a href="https://example.com">Chat </a>'; echo '<a href="https://example.com">Messages </a>'; echo '<a href="https://example.com">Reviews </a>'; echo '<a href="https://example.com">Testimonials </a>'; echo '<a href="https://example.com">News </a>'; echo '<a href="https://example.com">Google </a>'; } add_action('asgarosforum_custom_header_menu', 'my_menu');
Thanks a bunch
Naomi
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  </a>';
echo '<a href="https://example.com" class="center">Alerts  </a>';
echo '<a href="https://example.com" class="center">|Classifieds  </a>';
echo '<a href="https://example.com">Listings </a>';
echo '<a href="https://example.com">Chat </a>';
echo '<a href="https://example.com">Messages </a>';
echo '<a href="https://example.com">Reviews </a>';
echo '<a href="https://example.com">Testimonials </a>';
echo '<a href="https://example.com">News </a>';
echo '<a href="https://example.com">Google </a>';
}
add_action('asgarosforum_custom_header_menu', 'my_menu');
Thanks a bunch
Naomi
Uploaded files:Quote from Asgaros on September 19, 2019, 8:44 pmHello @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?
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?
Quote from naomibuch on September 20, 2019, 9:01 amHi 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’);
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:
Quote from hafizmorsalin on January 23, 2020, 11:08 am@naomibuch where you put to this code???
@naomibuch where you put to this code???
Quote from hafizmorsalin on January 23, 2020, 11:13 am@asgarosi want to change login and registration url from menu. but how could i do…plz helphere is screen shot for more….
Quote from Asgaros on February 3, 2020, 8:35 amHello @hafizmorsalin
You can change this URLs directly in the settings: Forum -> Settings -> URLs.
Hello @hafizmorsalin
You can change this URLs directly in the settings: Forum -> Settings -> URLs.