Jarisa Lintlha tsa morao-rao ka Sehlopha ka Menyu ea WordPress u sebelisa jQuery load

jquery

Haeba u etetse li-blog tse ling tse kholo joalo ka moo Mashable, o kanna oa hlokomela hore ba na le sistimi e ntle haholo ea menyu e oelang fatše mme e o fa ponahalo ho li-blog tsa morao-rao tse tsoang sehlopheng ka seng. Ho etsa bonnete ba hore leqephe ha le nke nako e telele ho laeloa, ba kenya litaba tseo ba sebelisa Ajax… ebe ba e jarolla pele feela kamora hore leqephe le behe ka botlalo.

WordPress Ajax Submenu

Re ne re batla ho etsa se tšoanang le mona Martech Zone. Ho fana ka leseli la mekhahlelo eo re nang le eona, ke ne ke batla ho bonts'a tse ling tsa melaetsa kahare ho e 'ngoe le e' ngoe. Re tseba hantle WordPress, WordPress API le jQuery empa e bile feela ho fihlela ke fumana sengoloa ho Ho lata Likarolo ka Sehlopha ho sebelisa jQuery hore re na le tharollo e ntle.

TLHOKOMELISO: Karolo e 'ngoe ea mokhoa oa bona eo ke sa lumeleng hore ke tharollo e ntle ke ho fetisa khokahano eohle ea query_post ka JavaScript… ho bonahala eka o ipula bakeng sa bosholu! Ke fetotse sengoloa sa sebaka sena sa marang-rang hore feela ke fetise lipehelo tse hlokahalang ka har'a query_posts command.

Thupelo e hata mosebelisi ka ho theha template hore e hule ka matla mehopolong, le hore na o ka etsa joang lihokelo tse ka qalang kopo. Ho ka be ho bile bonolo hola re ne re batla ho etsa likhokahano feela, empa re ne re hlile re batla ho sebelisa WordPress 'e hahiloeng ho menu ea ho sesa. Ka bomalimabe, li-link tsa WordPress tsa menyu li hlahisitse linomoro ha o ntse o eketsa le ho tlosa lintho tsa menyu… empa ha li na leseli la sehlopha seo u lakatsang ho se hula le ho se fetisa mohala oa hau oa Ajax.

Ho beha lethathamo la lintho hantle, re kentse khoutu ho WPreso, Kenya sehlopha / leqephe la slug ho lihlopha tsa lintho tsa menyu.

Ke bothata bo le bong feela… e sebeletsa leqephe kapa poso, empa ha e hlile ha e sebetse Sehlopha! Kahoo re ntlafalitse kopo ea slug ka:

$ slug = fumana_cat_slug ($ id);

Mme a eketsa ts'ebetso ho tsoa ho WPRecipes, Bolotsana ba WordPress: Fumana slug ea sehlopha u sebelisa ID ea sehlopha, Ho hula slug ea sehlopha hore e be sebopeho sa data ho menu ea ho sesa.

Kahoo… ka lebaka la boiteko bo kopanetsoeng ba libaka tse 3 tsa WordPress le tokiso e ntle ea jQuery guru ho DK New Media, SETSEBI SA MOLIMO: Stephen Coley (bakeng sa ho batalatsa menyu), re na le sistimi e ntle haholo ea submenu!

Mosebetsi oohle o phethetsoe ka har'a lifaele tsa rona tsa sehlooho Re kentse li-filters tsa menyu ea ho tsamaisa ho function.php, ra kenya submenu div ho file ea sehlooho ea rona ea hlooho.php, ra kenya template ea submenu ho bona, ra kenya file ea submenu JavaScript hloohong ea rona - re netefatsa hore jQuery e se e ntse e laetsoe ka har'a sehlooho sa rona. hape. Kea ts'epa hore o ananela mosebetsi, e bile ntlafatso e monate setsing!

8 Comments

  1. 1
  2. 6
  3. 8

U nahana eng?

Sebaka sena se sebelisa Akismet ho fokotsa spam. Ithute kamoo litlhaloso tsa hau li hlahang kateng.