Langsung ke konten utama

Switch or Change Different Menu When User Login or Logout in WordPress 2017

Display Another Menu After Login and Another Menu after Logout in WordPress




This steps is very usefull when you are wanted to display different menu when you are login or when you are logout, for example if you have a menu which has a Login in which you wanted this to replace as Dashboard or My Account menu after users or customer login to your WordPress site then the code below is usefull, so just follow the steps before adding the code.

Step 1:

Create two menu from your WordPress site and name the two menu as follows;

Menu 1: logged-in
Menu 2: logged-out

So if you create a menu 1 and consist of Home, Contact Us, Shop, My Account - so this means that menu 1 would be for login users or customers.

Then next is if you create a menu and consist of Home, Contact Us, Shop, Login - and this is for logged out users.

Then the next thing you need to do is add the code below from your WordPress functions.php Appearance>Editor>functions.php

And then paste the code on the first line of the functions.php file.


function my_wp_nav_menu_args( $args = '' ) {

if( is_user_logged_in() ) {
$args['menu'] = 'logged-in';
} else {
$args['menu'] = 'logged-out';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

After that just save and it should work now.

Komentar

Postingan populer dari blog ini

BOOTYFUL Lyrics by Ex Battalion

"Bootyful" (feat. Jroa, Emcee Rhenn, Flow-G, Brando & Bosx1ne) Let me see the booty baby show me baby And let's start around Let me have good look at baby Shake your booty now Let me see the booty baby show me baby And let's start around Let me have good look at baby Shake your booty now Let me see the booty baby show me baby And let's start around Let me have good look at baby Shake your booty now Girl you're so bootyful that ass so beautiful Girl you're so bootyful that ass so beautiful (Emcee!) Katawan na pambihira Kaya madaming nakapila Gusto nilang iuwi ka 'Di mo ko kilala pero sa'kin ka sumama Kanina pa kita pinagmamasdan The way you drop it down low ayaw kong pakawalan At hindi ako kuntento na titigan lang iyan I want your really ass baby pwede sa'kin ka lang Kaya 'wag ka mag atubili talikod patingin Baka pwede maka hawak sa pwet ay papisil Wala na'kong paki malinaw man o madilim O kaya naman maingay kahit tirang pahilim Laha...

Senior Project Management Supervisor - Full Time Job Hiring

Senior Project Management Supervisor Anflo Realty Development & Allied Services Corporation is looking for a dedicated and professional Senior project management supervisor, if you feel you are fit to this job then we encourage you to apply this job, just follow the steps provided here. Job Type:  Part-Time Job Location:  Davao City Job Description: Educational Attainment : Bachelor’s Degree in Civil Engineering or Architecture  Gender/Age : Male or Female  Experience : At least 5-10 years of supervisory work Company Information Anflo Realty Development & Allied Services Corporation Anflocor Corporate Center  Damosa Complex Lanang  Davao City, Davao City  8000  Website: http://www.anflocor.com

Need You Lyrics - Ex Battalion

NEED YOU Lyrics Ex Battalion [Hook: Skusta Clee] I just want your body, baby, lika na 'Di na'ko galit, baby, uwi ka na Hinihintay kita dito kanina pa I just want your body right now, now, now I just want your body, body, body I just want your body on me, on me I just want your body, body, body Come a little closer to me [Hook 2: Bosx1ne & Skusta Clee] I just want your body, baby, 'lika na 'Di na'ko galit, baby, uwi ka na Hinihintay kita dito kanina pa I just want your body right now, now, now [Refrain: Skusta Clee] I just want your body, body, body I’ll be grindin' on your booty, your booty, your booty I just wanna feel your body, your body, your body Fuck you right in the bed, lemme ride on yo', baby [Verse 1: Bosx1ne & JRoa] Ay, 'lil baby, ginawa mo sa‘kin lately Para bang ako’y naguguluhan, nagalit man pero, baby I just want more of you, your body is my cure Magalit man pero, baby, 'di ka iiwanan’s for sure Kanina pa kita hinihintay Nanana...