From the word itself, the word shortcode means exactly that: A short code; a shortcut code.
Shortcodes suna ba ka damar ƙara abubuwa a gidan yanar gizonka (kamar widgets, misali), ba tare da buƙatar ƙara manyan ɓangarorin lambobin shiri kamar yadda masu haɓakawa kan yi ba.
Misali, wani sashi na lambar shiri na yau da kullum, dangane da tsayi, zai iya zama kamar haka:
<html>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam id aliquam turpis. Vivamus quis arcu tincidunt, finibus urna eget, placerat risus. Aliquam arcu massa, finibus et lacinia sed, scelerisque nec augue. Quisque eu viverra sapien, vel consequat lorem. Integer vel erat tortor. Phasellus condimentum magna eget congue venenatis. Suspendisse blandit vehicula consectetur. Nullam sodales eleifend massa, in bibendum purus fermentum id. Morbi et turpis feugiat, malesuada ipsum sit amet, interdum nulla. In non ante nec nisl mattis gravida sit amet id lectus. </html>
A wannan misalin, bari mu ɗauka cewa sashin lambar shirin da ke sama zai ba ka damar ƙara cikakken sakin layi na rubutun wucin gadi na Lorem Ipsum.
Now, a shortcode with the same exact function as the code above will look something like this, in contrast:
[lorem ipsum dolor estat]Lorem Ipsum[/lorem]
You can see how they’re miles different from each other in terms of length.
Yanzu ka yi tunanin cewa duka ɓangarorin lambobin biyu– Na asali mai tsayi, idan aka kwatanta da shortcode ɗin da ke ɗauke da kalmar “lorem” kawai, duk za su yi abu ɗaya daidai: Ƙara rubutun Lorem Ipsum.
This is what shortcodes do. They make adding widgets, functions, and a bunch of other cool stuff easier for both ordinary WordPress users and developers alike.
Where can I find shortcodes?
Idan kana da wani plugin ko widget da kake so, akwai yiwuwar suna da shortcode da ke akwai don ka yi amfani da shi.
Shortcodes Ultimate, for example, will let you choose from hundreds of shortcodes that you can use on Page Builder Sandwich (or anywhere, actually) by simply grabbing the shortcode of your choice from Shortcode Ultimate’s repository or documentation page.
Adding Custom Shortcodes on PBS
A Page Builder Sandwich, za ka iya ƙara shortcodes kai tsaye a kan shafinka ta hanyar bugawa kawai ko kwafa da liƙa shi a yankin abun cikinka.
Mun yi wannan a ƙasa tare da wani shortcode daga Shortcodes Ultimate, inda muka ƙara akwatin abun ciki a shafin gwaji na Page Builder Sandwich:
Another thing you’ll find handy when using Page Builder Sandwich is our Shortcode Mapping feature.
Daga ɗaya daga cikin labaranmu da suka gabata kan Shortcode Mapping, ma’anar ita ce kamar haka:
Shortcode mapping is like letting Page Builder Sandwich memorize all the shortcodes available on your site: their names, descriptions, their attributes, and what each of these attributes do.
Wani ɓangare na wannan yana nufin cewa ba lallai ne ka nemi shortcodes ɗinka da kanka a cikin takaddun bayanansu ko ma’ajiyoyinsu ba.
Muddin kana da plugin ɗin da ya ƙunshi shortcode ɗin an girka shi a shafinka na WordPress, zai kasance a shirye cikin sauƙi don ka yi amfani da shi a Page Builder Sandwich.
So for example, if I wanted to add a WooCommerce shortcode on my page, all I have to do is make sure that it’s installed on my WordPress site, like so:
And then, to actually add the shortcode, I’ll just go to my page, and drag and drop the Shortcode Element:
Because we already have WooCommerce installed on our WordPress site, you can see that all of the shortcodes that are available on the WooCommerce plugin are already available on Page Builder Sandwich. This is what Shortcode Mapping is.
You can also see on the upper left corner that the ACF (Advanced Custom Fields) and MailChimp shortcodes are available– because we have those instlled on our WordPress site, too.
Don haka idan kana son ƙara shortcodes na musamman, ko shortcodes ɗin da ka ƙirƙira da kanka, za ka iya, muddin kana da su an girka su a shafinka na WordPress.
