Tengerani Zolemba Zatsopano ndi Gulu kudzera pa WordPress Menyu pogwiritsa ntchito jQuery katundu

jquery

Ngati mwayendera mabulogu akulu kunja uko monga Mashable, mutha kuzindikira kuti ali ndi dongosolo labwino kwambiri la menyu lomwe limatsika ndikukuwonetsani muma blog atsopano kuchokera pagulu lililonse. Kuonetsetsa kuti tsambalo silitenga kwamuyaya, amatsitsa zomwezo pogwiritsa ntchito Ajax… ndikuziyikanso pokhapokha tsamba likadzaza.

WordPress Ajax Submenu

Tinkafuna kuchita chimodzimodzi pano Martech Zone. Kuti ndiwonetsetse magawo omwe tili nawo, ndimafuna kuwonetsa zolemba zina mkati mwa aliyense. Tikudziwa bwino WordPress, WordPress API ndi jQuery koma sizinachitike mpaka nditapeza nkhani pa Kujambula Zolemba ndi Gulu pogwiritsa ntchito jQuery kuti tinali ndi yankho labwino.

Dziwani: Chimodzi mwanjira zawo zomwe sindikukhulupirira kuti ndi yankho labwino ndikudutsa chingwe chonse cha query_post kudzera pa JavaScript… zikuwoneka ngati mukudzitsegulira nokha! Ndasintha script ya tsambali kuti ndingodutsa magawo ofunikira pakayitanitsa_matumizi.

Phunziroli limathandizira wogwiritsa ntchito popanga template kuti akokere mwamphamvu pazotumizirazo, ndi momwe angapangire maulalo omwe angayambitse pempholo. Zikadakhala zosavuta tikadangofuna kulumikizana, koma timafunadi kugwiritsa ntchito WordPress 'yomangidwa posanja menyu. Tsoka ilo, maulalo amawu a WordPress apanga manambala pamene mukuwonjezera ndikuchotsa zinthu zakunyumba… koma alibe chidziwitso pagulu lomwe mukufuna kukoka ndikudutsa foni yanu ya Ajax.

Polemba mndandanda wazinthu moyenera, tidaphatikizira nambala yochokera ku WPreso, Onjezani tsamba / tsamba la slug m'kalasi yazinthu zamenyu.

Vuto limodzi lokha… limagwira ntchito patsambalo kapena positi, koma silinagwire ntchito Gulu! Chifukwa chake tidasintha pempho la slug ndi:

$ slug = pezani_cat_slug ($ id);

Ndipo adaonjezera ntchitoyi kuchokera ku WPRecipes, Chinyengo cha WordPress: Pezani gulu slug pogwiritsa ntchito ID, Kuti mubwezeretse slug m'gululi kukhala chidziwitso chazosankha.

Chifukwa chake ... chifukwa chothandizana nawo masamba a 3 WordPress ndikutsata bwino ndi jQuery guru lathu ku DK New Media, Stephen Coley (yosalaza menyu), tili ndi dongosolo labwino kwambiri la submenu!

Ntchito zonse zidakwaniritsidwa m'mafayilo athu azimutu. Tidakweza zosefera pamenyu pa works.php, ndikuwonjezera submenu div ku fayilo yathu yamutu wa mutu.php, ndikuwonjezera template ya submenu kwa iwo, ndikunyamula fayilo ya submenu JavaScript pamutu wathu - kuwonetsetsa kuti jQuery yadzaza kale pamutu wathu komanso. Tikukhulupirira kuti mumayamikira ntchitoyo, inali nkhani yosangalatsa pamalopo!

8 Comments

  1. 1
  2. 6
  3. 8

Mukuganiza chiyani?

Tsambali likugwiritsa ntchito Akismet kuchepetsa spam. Phunzirani momwe deta yanu ikufotokozera.