Kwụsị imelite afọ na azụmahịa na saịtị WordPress gị na Shortcode a

Afọ na Business Shortcode maka WordPress

Otu n'ime ihe kasịnụ banyere WordPress bụ mgbanwe iji wuo ụzọ mkpirisi. Czọ mkpirisi bụ ntọala ndị gbanwere agbanwe ị nwere ike itinye n'ime ọdịnaya gị nke na-eme ka ọdịnaya dị ike.

Ana m enyere onye ahịa aka n’izu a ebe ha na-ewere otu n’ime ngwaahịa ha wee tụgharịa ya na ngalaba ọhụrụ. Saịtị ahụ bụ ọtụtụ narị peeji nke ibe ya ma bụrụ ọrụ dị egwu. Ka anyị na-arụ ọrụ na ndepụta nke mbipụta, otu nke pụtara bụ na e nwere ọtụtụ post blog, ibe, na oku na-eme omume nke gwara ụlọ ọrụ ahụ afọ ole na ole na azụmaahịa.

Pagesfọdụ peeji nwere 13, ụfọdụ 15, ndị ọzọ ziri ezi na 17… dabere na mgbe e dere ha. Nke a bụ otu n'ime mmezigharị ndị na-enweghị isi iji chọọ nke obere koodu ga - ejikwa zuru oke.

Naanị ihe anyị kwesịrị ime bụ ịdebanye aha koodu dị mkpirikpi nke na-ewe afọ dị ugbu a ma wepụta ya site na afọ ụlọ ọrụ ahụ malitere. Anyị nwere ike ịdenye koodu mkpirisi ma tinye ọrụ ahụ n'ime isiokwu isiokwu saịtị ahụ functions.php faịlụ:

function YIB_shortcode() {
   $start_year = '2003';
   $current_year = date('Y');
   $displayed_year = $current_year - $start_year;
   $years = $displayed_year;
   return $years;
}
add_shortcode('YIB', 'YIB_shortcode');

Ihe ọrụ a na-eme bụ iwepu afọ ugbu a site na 2003 iji wepụta ọnụọgụ kwesịrị ekwesị nke afọ ụlọ ọrụ ahụ na-azụ ahịa.

Yabụ, ọ bụrụ na m chọrọ ide oge ole ụlọ ọrụ ahụ na-azụ ahịa n'ime ọdịnaya saịtị ahụ, naanị m na-ede:

Our company has been in business for [YIB]+ years!

N'ezie, ị nwere ike ịnweta ụdị mgbagwoju anya nke ukwuu this ị nwere ike iji HTML, onyonyo, CSS, wdg mana nke a bụ naanị ihe atụ dị mfe iji jide n'aka na saịtị gị ziri ezi!

Kedu ihe ị chere?

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