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

Everwing Permanent Coin and Thropy 9999999 Hacked 2017

How To Hack Everwing Using PC Browser Opera , Chrome and Mozilla Firefox Are you one of Everwing addicts and wanted to get many coins and trophy to upgrade and get legendary dragon to achieved instant successful play on this popular game from Messenger? well today we will going to provide you a tutorial on how you can get the Everwing hack 2017. NOTE: Everwing hacked provided here is intended for educational purposes only, we are not responsible for any circumstances you might encounter, this hacked is for fun only and this is tested for many users. Things To Consider Before Doing the Hacking Process  You will need to use your PC to make this work, and also you need to use a browser listed below. Opera Browser (Recommended) - This is tested for our staff and it works. Google Chrome Mozilla Firefox Now after you open your PC and then open browser, just go to Messenger.com and then load the Everwing game , then select the character and then right click + inspect element, now next th

Things You Didn't Know About Kiwi Fruit and It's Health Benefits

Kiwi or Kiwifruit have many names in different country. Chinese gooseberry is most popular secondary name for this fruit. It is a small ( about the large size of hen’s egg ), light colour brown and a fuzzy skin covered in the outside. Then the inside is a colour lime green having a small tiny black seeds that make it an eye catching. Kiwifruit is native in China and its said to be their National Fruit. It is first cultivated in New Zealand and known as Chinese gooseberry. Kiwifruit is said to be having more Vitamin C than Orange. Kiwifruit is a soft creamy and sweet but a unique taste. Natural List Contain by KIWI as follows: Vitamin A – 3 mcg Vitamin C – 105.4 mg Potassium – 215mg to 252mg ( depends on type of KIWI ) Dietary Fiber – 2. 7 g Protein – 0.8 g Total fat – 0.4 g Iron – 0.2 g Folate – 17 mcg Copper – 0.09 mg Vitamin E – 1.01 mg Manganese – 0.07 mg Vitamin B6 – 0.063 mg Vitamin A equiv. lutein zeaxanthin - 114 μg HEALTH BENEFITS OF KIWI FRUIT Protects DNA – be

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