From the word itself, the word shortcode means exactly that: A short code; a shortcut code.
Nagbibigay-daan ang mga shortcode na magdagdag ka ng mga bagay sa iyong website (tulad ng mga widget, halimbawa), nang hindi kinakailangang magdagdag ng malalaking tipak ng code tulad ng karaniwang ginagawa ng mga developer.
Halimbawa, ang isang karaniwang piraso ng code, batay sa haba, ay malamang na magiging katulad nito:
<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>
Para sa halimbawang ito, ipalagay natin na ang piraso ng code sa itaas ay magbibigay-daan sa iyo na magdagdag ng isang buong talata ng placeholder text 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.
Ngayon, isipin na ang parehong piraso ng code– Ang orihinal at mahabang piraso, laban sa shortcode na naglalaman lamang ng salitang “lorem”, ay parehong gagawa ng eksaktong parehong bagay: Magdagdag ng tekstong 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?
Kung mayroon kang paboritong plugin o widget, malaki ang posibilidad na mayroon silang available na shortcode na magagamit mo.
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
Sa Page Builder Sandwich, maaari kang magdagdag ng mga shortcode nang direkta sa iyong pahina sa pamamagitan lamang ng pag-type o pag-copy-paste nito sa iyong content area.
Ginawa namin ito sa ibaba gamit ang isang shortcode mula sa Shortcodes Ultimate, na nagdaragdag ng content box sa demo page ng Page Builder Sandwich:
Another thing you’ll find handy when using Page Builder Sandwich is our Shortcode Mapping feature.
Mula sa isa sa aming mga nakaraang artikulo tungkol sa Shortcode Mapping, ang kahulugan ay ang sumusunod:
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.
Bahagi nito ay nangangahulugang hindi mo na kailangang manu-manong hanapin ang iyong mga shortcode sa kani-kanilang dokumentasyon o repository.
Basta’t naka-install sa iyong WordPress site ang plugin na naglalaman ng shortcode, magiging madali itong magagamit sa 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.
Kaya kung nais mong magdagdag ng mga custom na shortcode, o mga shortcode na ikaw mismo ang gumawa, maaari mo itong gawin, basta’t naka-install ang mga ito sa iyong WordPress site.
