What is KJD Menu Swapper
This Plugin designed to allow you to contextualize the menus in your theme based on whether or not your visitor is logged in or not. It’s especially handy when this functionality is not built into your theme!
Please report any bugs or feel free to give me any feedback at https://kneejerk.dev/ via the contact form at the bottom. Alternatively, if you’re on Github, you can create an issue for me instead.
How does it work
After installing KJD Menu Swapper, you’ll see the Menu Swapper on the left admin navigation. Once you click there, you’ll be presented with the configuration for the plugin. This plugin does a few things to work:
- KJD grabs the menus that your theme has registered. Whatever your theme, if it registers its menus properly, KJD Menu Swapper will find it =]
- KJD then grabs the menus that you’ve configured under Appearance -> Menus
- If a menu is configured for a registered theme menu, KJD Menu Swapper will show you. Otherwise, it’ll say “None Selected”.
- In the dropdown next to what the theme is configured for, you have the option to “swap” it when the visitor is logged in.
- Click the enable checkbox for that menu to enable the swap.
- Next, bonk the “Save” button, and the menu swap is live!
A Note from the Author
It’s designed to be pretty easy to use, but this plugin will only get better with constructive feedback from people who are using it like you!
Ryan “Rohjay” Oeltjenbruns
- Upload the
kneejerk_menu_swapperdirectory to your site’s
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Configure the plugin through the wp-admin area from the “Menu Swapper” navigation link on the left
Why should I use this plugin?
The best examples of how to use this plugin are where you have a navigation menu with login/logout functionality, or perhaps you’d like to add items to your navigation menus for when someone is logged in. In these scenarios, figure out which location the menu title is describing, create another menu in the wp-admin’s Appearance -> Menus similar to it (with the additions and/or changes), and use that menu for the swap.
Can I swap based off the user role?
Not yet. I’ve thought of this feature, but haven’t yet had the demand to implement it! If you feel this would be a great addition – send me a note on https://kneejerk.dev via the contact form at the bottom!
All of the menus the KJD Menu Swapper knows about are created in the wp-admin area’s Appearance -> Menus. Once you’ve created a menu there, set it as the menu for different registered menu locations in your theme as usual. Once that’s done, the KJD Menu Swapper can allow you to swap that menu to a separate one designed for users that are logged in.
This is because your active theme doesn’t have any registered nav menus. In this scenario, the KJD Menu Swapper plugin isn’t going to be able to swap any of your menus when someone is logged in.
KJD Menu Swapper isn’t built to disable menus by design. If this is a feature that KJD Menu Swapper should work for, I’d love to hear that feedback. As it sits, I’ve made the conscience decision (perhaps in error) to not honor those swaps.
以下人員參與了開源軟體〈Kneejerk Menu Swapper〉的開發相關工作。參與者
將〈Kneejerk Menu Swapper〉外掛本地化為台灣繁體中文版
Tested on WP 5.8 and incremented plugin version #
Fixed readme typo – whoops!
Formatting so the Repo information is correct and doesn’t look terrible!
Initial Version (first round of WP Plugin Repo code review)