Courses on mobile footer menu
Shahjahan Jewel please how do I add courses on mobile footer menu.
Also in the profile
Please, do you have a plan to add this feature in the future?
Use this hook:
add_filter('fluent_community/mobile_menu', function ($mobileMenuItems, $xprofile, $context) {
return $mobileMenuItems;
}, 10, 3);
WiLson EberechiΒ no luck, not working...
Bryan WilliamΒ Yo that's the hook, I have used that to remove space and insert custom link for someone here.
I am looking for the snippet here can't find it.
I'm outside, if I was indoors I would have written the codes to insert course to the snippet.
You can search mobile menu in fluent community developer doc.
Bryan WilliamΒ oh you just copy the code and paste? It won't work that way.
I just showed you the hook, it's up to you to work within the hook I sent.
Example: the below removes space and add your course.
add_filter('fluent_community/mobile_menu', function($menuItems, $xprofile, $context) {
// Remove 'spaces' (groups) from mobile menu
$menuItems = array_filter($menuItems, function($item) {
return !isset($item['route']['name']) || $item['route']['name'] !== 'spaces';
});
// Add your custom page (library)
$menuItems[] = [
'route' => [
'name' => 'custom_page',
'params' => [
'slug' => 'library' // Your custom page slug
]
],
'icon_svg' => '<svg> your svg code </svg>'
];
return array_values($menuItems); // Re-index array
}, 10, 3);
You can also use a
...
WiLson EberechiΒ thanks so much. This hook replaces spaces with courses...
I wanted to add the 5th tab and not replace spaces
Bryan WilliamΒ You can use this snippet.
add_filter('fluent_community/mobile_menu', function($menuItems) {
$menuItems[] = [
'route' => [
'name' => 'courses',
],
'icon_svg' => '<svg width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M10.734 5.84746L14.7114 6.9072M9.88139 9.01146L11.8701 9.54132M9.98031 14.9723L10.7758 15.1843C13.0258 15.7838 14.1508 16.0835 15.037 15.5747C15.9233 15.0659 16.2247 13.9473 16.8276 11.71L17.6802 8.54599C18.2831 6.3087 18.5845 5.19006 18.0728 4.30879C17.5611 3.42752 16.4362 3.12778 14.1862 2.52831L13.3907 2.31636C11.1407 1.71688 10.0157 1.41714 9.12948 1.92594C8.24322 2.43474 7.94178 3.55338 7.3389 5.79067L6.4863 8.95466C5.88342 11.1919 5.58198 12.3106 6.09367 13.1919C6.60536 14.0731 7.73034 14.3729 9.98031 14.9723Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M9.99996 17.4559L9.20634 17.672C6.96165 18.2832 5.83931 18.5889 4.95512 18.0701C4.07093 17.5513 3.7702 16.4107 3.16874 14.1295L2.31814 10.9035C1.71668 8.62232 1.41595 7.48174 1.92643 6.58318C2.36802 5.80591 3.33329 5.83421 4.58329 5.83411" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>'
];
return $menuItems;
}, 10);
Raiyan MarzanΒ Wow... Thanks it actually works.
But how do I change the position?
Maybe put in in the middle or close to space.
I want want the "profile tab" to maintain its former position.
Raiyan MarzanΒ Any luck yet
// Add Courses to the mobile footer menu
// Change the position number to control where it appears:
// 0 = first, 1 = second, 2 = third (middle), etc.
add_filter('fluent_community/mobile_menu', function ($menuItems) {
$coursesItem = [
'route' => [
'name' => 'courses',
],
'icon_svg' => '<svg width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M10.734 5.84746L14.7114 6.9072M9.88139 9.01146L11.8701 9.54132M9.98031 14.9723L10.7758 15.1843C13.0258 15.7838 14.1508 16.0835 15.037 15.5747C15.9233 15.0659 16.2247 13.9473 16.8276 11.71L17.6802 8.54599C18.2831 6.3087 18.5845 5.19006 18.0728 4.30879C17.5611 3.42752 16.4362 3.12778 14.1862 2.52831L13.3907 2.31636C11.1407 1.71688 10.0157 1.41714 9.12948 1.92594C8.24322 2.43474 7.94178 3.55338 7.3389 5.79067L6.4863 8.95466C5.88342 11.1919 5.58198 12.3106 6.09367 13.1919C6.60536 14.0731 7.73034 14.3729 9.98031 14.9723Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M9.99996 17.4559L9.20634 17.672C6.96165 18.2832 5.83931 18.5889 4.95512 18.0701C4.07093 17.5513 3.7702 16.4107 3.16874 14.1295L2.31814 10.9035C1.71668 8.62232 1.41595 7.48174 1.92643 6.58318C2.36802 5.80591 3.33329 5.83421 4.58329 5.83411" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>'
];
// Insert at position 2
// Adjust this number to move the Courses tab left or right
$position = 2;
array_splice($menuItems, $position, 0, [$coursesItem]);
return $menuItems;
}, 10);
Tawsif Ahmed RiyadΒ Thanks very much, it works 100%
