Created
December 26, 2025 15:55
-
-
Save Jerl92/27ca99a9f6d8878c3fa6aa9bb9477dd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function add_custom_item_to_menu( $items, $args ) { | |
| if ( $args->theme_location == 'primary-menu' ) { | |
| $user = wp_get_current_user(); | |
| $user_meta = get_userdata($user->ID); | |
| $user_role = $user_meta->roles[0]; | |
| if($user_role == 'um_employeur' || $user_role == 'administrator'){ | |
| $items .= "<li id='main-menu'><a href='https://monemploi.net/ajouter-un-emploi/'>Ajouter un emploi</a></li>"; | |
| } | |
| } | |
| return $items; | |
| } | |
| add_filter( 'wp_nav_menu_items', 'add_custom_item_to_menu', 10, 2 ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment