WordPress 3.0 မှာ Menu ဆိုတာ ထပ်ပါလာပါတယ်။ Menu က theme အဟောင်းတွေမှာ သုံးလို့မရပါဘူး။ Menu ကို သုံးမယ်ဆိုရင် menu register လုပ်မှရပါတယ်။
[lang name=”php”]
// To allow to use Nav
register_nav_menus( array(
‘primary’ => ‘Menu Description’,
‘secondary’=>’Second Menu Description’,
) ); [/lang]

Primary ကတော့ id ပေါ့။ Primary Navigation ကတော့  Description အတွက်ပါ။ array နဲ့ တစ်ကြိမ်တည်းမှာ Menu တွေအများကြီးထည့်သွားဖို့အတွက်ပေါ့။ Menu တစ်ခုပဲ သုံးမယ်ဆိုရင်တော့
[lang name=”php”]
register_nav_menu( “primary”, “Menu Description”  );
[/lang]
ကို ခေါ်သုံးရင်ရပါတယ်။
Menu ကို template မှာ ခေါ်သုံးချင်တယ်ဆိုရင်တော့
[lang name=”php”]
// Call menu setting
<?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>
[/lang]
လို့ ခေါ်ပြီး သုံးလို့ရပါတယ်။ theme_location က ကိုယ်ပေးထားခဲ့တဲ့ ID ကို  ခေါ်ဖို့ပါ။ nav menu က အရင်တုန်းကထက် ကောင်းတာတွေ container တွေထည့်လို့ရတယ်။ id နဲ့ class ကို ကိုယ့် စိတ်ကြိုက်ပေးလို့ရတယ်။ array list ကိုတော့ ဒီမှာ ဖတ်ကြည့်လိုက်ပါ။

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Saturngod

Subscribe now to keep reading and get access to the full archive.

Continue reading