WordPress: Ghichaa Shortcode Site na Okwu Nne na Nna na Okwu Nwa Gị

API WordPress

Ọfọn, ọ dịtụla anya kemgbe m kesara ụfọdụ ndụmọdụ na mmemme na WordPress. N'oge na-adịbeghị anya, alaghachila m n'oche bench maka itinye ndị ahịa anyị niile na ọ bụ ihe na-atọ ụtọ ịlaghachi n'ime ngbanwe nke ihe. O nwere ike ịbụ na ị hụla njikọta Mgbasa Ozi Mgbasa Ozi ohuru na saịtị ahụ - nke ahụ bụ nnọọ a fun oru ngo!

Taa, enwere m okwu dị iche. Ọtụtụ ndị ahịa anyị nwere bọtịnụ etinyere site na mkpirisi isiokwu ndị nne na nna. Otu n'ime ndị mmekọ anyị na Elel Marketing Solutions jụrụ ma ọ bụrụ na anyị nwere ike ịme ụfọdụ nsuso mmemme na bọtịnụ ebe ọ bụ na ha bụ nnukwu oku na-eme na saịtị niile. Shortcode mkpọchi bụ ihe ọ bụla karịa arịlịka mkpado na e mere a bit ọzọ ikwupụta okwu iji a usoro nke ọmụmụ na-bi na site shortcode nhọrọ.

Maka nke a, anyị kwesịrị ịtinye ihe omume onclick na ederede arịlịka iji debanye ihe omume. Nke a bụ ihe ọ nwere ike ịdị ka:

Igodo ụlọ

N'ezie, nsogbu bụ, na e nwere shortcode na ebe anyị isiokwu nne na nna na anyị achọghị dezie a nne na nna isiokwu. Ma, ebe ọ bụ na etinye koodu mkpirisi gafee ọdịnaya niile na saịtị ahụ, anyị achọghị ịmepụta koodu ọhụụ.

Azịza ya dị mma. WordPress API -enye gị ohere iwepu shortcode! Yabụ, na isiokwu nwa anyị, anyị nwere ike wepu koodu mkpirisi ahụ, wee jiri ọrụ mkpụmkpụ ọhụrụ anyị dochie ya:

add_action ('mgbe_setup_theme', 'ịkpọ_ku_theme_setup');
ọrụ Call_child_theme_setup () {remove_shortcode ('old_button_function_in_parent_theme'); add_shortcode ('bọtịnụ', 'new_button_function_in_child_theme'); }
ọrụ new_button_function_in_child_theme ($ atts, $ content = null) {... koodu ohuru gi di ebe a ...}

Na ọrụ bọtịnụ ọhụrụ m (na My Child's function.php), m degharịrị ọrụ shortcode iji tinye ihe omume dị egwu naClick omume. Mmepụta na-arụ ọrụ mara mma ma na-enyocha ugbu a na Google Analytics!

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.