From the word itself, the word shortcode means exactly that: A short code; a shortcut code.
Shortcode-urile vă permit să adăugați elemente pe site-ul dvs. web (cum ar fi widgeturile, de exemplu), fără a fi nevoie să adăugați fragmente uriașe de cod, așa cum ar face în mod normal dezvoltatorii.
De exemplu, o bucată obișnuită de cod, în ceea ce privește lungimea, ar arăta probabil cam așa:
<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>
Pentru acest exemplu, să presupunem că fragmentul de cod de mai sus vă va permite să adăugați un paragraf întreg de text demonstrativ 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.
Acum imaginați-vă că ambele bucăți de cod – fragmentul original, lung, față de shortcode-ul care conține doar cuvântul „lorem” – ar face ambele exact același lucru: adaugă text 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?
Dacă aveți un modul sau un widget preferat, sunt șanse mari ca acestea să aibă un shortcode disponibil pentru a fi utilizat.
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
Pe Page Builder Sandwich, puteți adăuga shortcode-uri direct pe pagina dvs., doar tastându-le sau copiindu-le și inserându-le în zona de conținut.
Am făcut acest lucru mai jos cu un shortcode din Shortcodes Ultimate, adăugând o casetă de conținut pe pagina demo Page Builder Sandwich:
Another thing you’ll find handy when using Page Builder Sandwich is our Shortcode Mapping feature.
Dintr-unul dintre articolele noastre anterioare despre Maparea Shortcode-urilor, definiția este următoarea:
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.
O parte din aceasta înseamnă că nu mai trebuie să căutați manual shortcode-urile în documentațiile sau depozitele respective.
Atâta timp cât aveți instalat pe site-ul dvs. wordpress modulul care include shortcode-ul, acesta va fi ușor accesibil pentru utilizare pe 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.
Așadar, dacă doriți să adăugați shortcode-uri personalizate sau shortcode-uri create de dvs., puteți face acest lucru, atâta timp cât le aveți instalate pe site-ul dvs. WordPress.
