WordPress: E kākau i kahi pōkole mai kahi mākua mākua i kāu kumumanaʻo keiki

WordPress API

ʻĀ, lōʻihi iki ia mai koʻu kaʻana like ʻana i kekahi mau ʻōlelo aʻoaʻo e pili ana i ka hoʻolālā ʻana ma WordPress. I kēia mau lā, ua hoʻi wau i ka pākaukau e hoʻouka nei i nā code no kā mākou mea kūʻai aku āpau a leʻaleʻa e hoʻi i loko o ke ʻano o nā mea. Ua ʻike paha ʻoe i ka hoʻopili hou ʻana o Marketing Whitepaper ma loko o ka pūnaewele - a papahana leʻaleʻa!

I kēia lā, he ʻokoʻa kaʻu hihia. ʻO ka hapa nui o kā mākou mea kūʻai aku i nā pihi i hoʻokō ʻia ma o nā pōkole poʻomanaʻo makua. Ua noi aku kekahi o kā mākou pakanā ma Elevated Marketing Solutions inā hiki iā mākou ke hana i kahi hanana hanana ma nā pihi ʻoiai lākou i kāhea nui ʻia ma nā pūnaewele. ʻAʻole nā ​​mea pihi Shortcode ma mua o kahi heleuma i hoʻolālā ʻia i kahi manawa maʻalahi e hoʻohana ana i nā papa o nā papa i noho ʻia e nā koho shortcode.

Ma muli o kēia, pono mākou e hoʻohui i kahi hanana onclick i ka heleuma i hoʻopaʻa inoa ai e hoʻopaʻa inoa i kahi hanana. Eia pehea ke ʻano:

Pihi Home

ʻO ka pilikia, ʻoiai, aia kahi helu pōkole ma kahi o kā mākou kumuhana makua a ʻaʻole makemake mākou e hoʻoponopono i kahi poʻo makua. A, ma muli o ka hoʻouna ʻia ʻana o ka shortcode ma o ka ʻike ma nā wahi āpau o ka pūnaewele, ʻaʻole makemake mākou e hana i kahi shortcode hou.

Pāleʻaleʻa ka hopena. ʻO WordPress API ʻae iā ʻoe e hemo i kahi code pōkole! No laila, i loko o kā mākou poʻomanaʻo keiki, hiki iā mākou ke hemo i ka shortcode, a laila hoʻololi iā ia me kā mākou hana papa kuhikuhi hou:

add_action ('after_setup_theme', 'calling_child_theme_setup');
hana calling_child_theme_setup () {wehe_shortcode ('old_button_unction_in_parent_theme'); add_shortcode ('pihi', 'new_button_unction_in_child_theme'); }
hana new_button_unction_in_child_theme ($ atts, $ content = null) {... eia kāu code pōkole hou ...}

I kaʻu hana pihi hou (i nā hana a kaʻu Theme Theme .php), kākau hou wau i ka hana shortcode e hoʻopili i kahi hanana hōʻeuʻeu onClick hanana. Hana maikaʻi ka hoʻopuka a ke nānā nei i kēia manawa ma Google Analytics!

Pehea kou manaʻo?

Ke hoʻohana nei kēia pūnaewele i ka Akismet e ho'ēmi i ka spam. E aʻo pehea e hanaʻia ai kāuʻikeʻikepili.