I-WordPress: Bhala ngaphezulu i-Shortcode Kusuka Kutimu Yomzali ku-Ingane Yakho Itimu

I-WordPress API

Hhayi-ke, sekunesikhathi impela ngabelana ngamathiphu wokuhlela nge-WordPress. Muva nje, ngibuyele ebhentshini ngifaka ikhodi yawo wonke amaklayenti ethu futhi bekumnandi ukubuyela ekuguqukeni kwezinto. Kungenzeka ukuthi uqaphele ukuhlanganiswa okusha kwe-Marketing Whitepaper kuyo yonke indawo - lokho bekuyi- iphrojekthi emnandi!

Namuhla, benginenkinga ehlukile. Amaklayenti ethu amaningi anezinkinobho ezifakiwe ngokusebenzisa ama-shortcode wetimu yomzali. Omunye wozakwethu ku-Elevated Marketing Solutions ubuze ukuthi singakwazi yini ukulandela ngomkhondo izinkinobho ngoba bezinhle kakhulu ekubizweni kuzona zonke izingosi. Izinkinobho ze-Shortcode azilutho ngaphandle kwethegi yehange elenzelwe kancane kahle ngokusebenzisa uchungechunge lwamakilasi agcwele izinketho ze-shortcode.

Ngenxa yalokhu, besidinga ukufaka umcimbi wokuchofoza kumbhalo wehange ukuze sibhalise umcimbi. Nakhu ukuthi kungabukeka kanjani:

Inkinobho Yasekhaya

Inkinga, kunjalo, ukuthi kukhona i-shortcode endaweni yethu ingqikithi yomzali futhi asifuni ukuhlela itimu yomzali. Futhi, njengoba i-shortcode isatshalaliswa kokuqukethwe kuyo yonke indawo, futhi asifuni ukudala i-shortcode entsha.

Isixazululo sihle kakhulu. I-WordPress API ikuvumela ukuthi ususe i-shortcode! Ngakho-ke, kungqikithi yethu yengane, singasusa i-shortcode, bese siyifaka esikhundleni somsebenzi wethu omusha we-shortcode:

i-add_action ('after_setup_theme', 'calling_child_theme_setup');
umsebenzi ubiza_child_theme_setup () {remove_shortcode ('old_button_function_in_parent_theme'); i-add_shortcode ('inkinobho', 'new_button_function_in_child_theme'); }
sebenza new_button_function_in_child_theme ($ atts, $ content = null) {... i-shortcode yakho entsha isilapha ...}

Ekusebenzeni kwami ​​kwenkinobho entsha (ku-My Theme's works.php), ngiphinde ngabhala umsebenzi we-shortcode ukufaka umcimbi onamandla kuClick umcimbi. Umphumela usebenza kahle futhi manje uyalandelela ku-Google Analytics!

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.