Skip to content

Instantly share code, notes, and snippets.

@brandonbarringer
Last active October 12, 2022 12:19
Show Gist options
  • Save brandonbarringer/19c158ee2cc362000f1fc6af6a8b617a to your computer and use it in GitHub Desktop.
Save brandonbarringer/19c158ee2cc362000f1fc6af6a8b617a to your computer and use it in GitHub Desktop.
Elementor Snippets for VScode
{
"PHP Elementor": {
"scope": "php,html",
"prefix": "elementor",
"body": [
"<?php",
"namespace Theme\\Elementor;",
"",
"use Elementor\\Controls_Manager;",
"use Elementor\\Controls_Stack;",
"use Elementor\\Repeater;",
"use Helpers;",
"use Theme\\Elementor\\Bases\\ThemeWidgetBase;",
"",
"class ${TM_FILENAME_BASE} extends ThemeWidgetBase {",
"\tpublic function get_name() {",
"\t\treturn '${5}-${TM_FILENAME_BASE/([A-Z][a-z]+$)|((^|[A-Z])[a-z]+)/${1:/downcase}${2:/downcase}${2:+-}/gm}';",
"\t}",
"",
"\tpublic function get_title() {",
"\t\treturn '${TM_FILENAME_BASE/(\\B)([A-Z]+|\\d+)/${1: }${2: }/gm}';",
"\t}",
"",
"\tpublic function get_icon() {",
"\t\treturn 'eicon-${3|editor-link,editor-unlink,editor-external-link,editor-close,editor-list-ol,editor-list-ul,editor-bold,editor-italic,editor-underline,editor-paragraph,editor-h1,editor-h2,editor-h3,editor-h4,editor-h5,editor-h6,editor-quote,editor-code,elementor,elementor-circle,pojome,plus,menu-bar,apps,accordion,alert,animation-text,animation,banner,blockquote,button,call-to-action,captcha,carousel,checkbox,columns,countdown,counter,date,divider-shape,divider,download-button,dual-button,email-field,facebook-comments,facebook-like-box,form-horizontal,form-vertical,gallery-grid,gallery-group,gallery-justified,gallery-masonry,icon-box,image-before-after,image-box,image-hotspot,image-rollover,info-box,inner-section,mailchimp,menu-card,navigation-horizontal,nav-menu,navigation-vertical,number-field,parallax,php7,post-list,post-slider,post,posts-carousel,posts-grid,posts-group,posts-justified,posts-masonry,posts-ticker,price-list,price-table,radio,rtl,scroll,search,select,share,sidebar,skill-bar,slider-3d,slider-album,slider-device,slider-full-screen,slider-push,slider-vertical,slider-video,slides,social-icons,spacer,table,tabs,tel-field,text-area,text-field,thumbnails-down,thumbnails-half,thumbnails-right,time-line,toggle,url,t-letter,wordpress,text,anchor,bullet-list,code,favorite,google-maps,image,photo-library,woocommerce,youtube,flip-box,settings,headphones,testimonial,counter-circle,person,chevron-right,chevron-left,close,file-download,save,zoom-in,shortcode,nerd,device-desktop,device-tablet,device-mobile,document-file,folder-o,hypster,h-align-left,h-align-right,h-align-center,h-align-stretch,v-align-top,v-align-bottom,v-align-middle,v-align-stretch,pro-icon,mail,lock-user,testimonial-carousel,media-carousel,section,column,edit,clone,trash,play,angle-right,angle-left,animated-headline,menu-toggle,fb-embed,fb-feed,twitter-embed,twitter-feed,sync,import-export,check-circle,library-save,library-download,insert,preview-medium,sort-down,sort-up,heading,logo,meta-data,post-content,post-excerpt,post-navigation,yoast,nerd-chuckle,nerd-wink,comments,download-circle-o,library-upload,save-o,upload-circle-o,ellipsis-h,ellipsis-v,arrow-left,arrow-right,arrow-up,arrow-down,play-o,archive-posts,archive-title,featured-image,post-info,post-title,site-logo,site-search,site-title,plus-square,minus-square,cloud-check,drag-n-drop,welcome,handle,cart,product-add-to-cart,product-breadcrumbs,product-categories,product-description,product-images,product-info,product-meta,product-pages,product-price,product-rating,product-related,product-stock,product-tabs,product-title,product-upsell,products,bag-light,bag-medium,bag-solid,basket-light,basket-medium,basket-solid,cart-light,cart-medium,cart-solid,exchange,preview-thin,device-laptop,collapse,expand,navigator,plug,dashboard,typography,info-circle-o,integration,plus-circle-o,rating,review,tools,loading,sitemap,click,clock,library-open,warning,flow,cursor-move,arrow-circle-left,flash,redo,ban,barcode,calendar,caret-left,caret-right,caret-up,chain-broken,check-circle-o,check,chevron-double-left,chevron-double-right,undo,filter,circle-o,circle,clock-o,cog,cogs,commenting-o,copy,database,dot-circle-o,envelope,external-link-square,eyedropper,folder,font,adjust,lightbox,heart-o,history,image-bold,info-circle,link,long-arrow-left,long-arrow-right,caret-down,paint-brush,pencil,plus-circle,zoom-in-bold,sort-amount-desc,sign-out,spinner,square,star-o,star,text-align-justify,text-align-center,tags,text-align-left,text-align-right,close-circle,trash-o,font-awesome,user-circle-o,video-camera,heart,wrench,help,help-o,zoom-out-bold,plus-square-o,minus-square-o,minus-circle,minus-circle-o,code-bold,cloud-upload,search-bold,map-pin,meetup,slideshow,t-letter-bold,preferences,table-of-contents,tv,upload,instagram-comments,instagram-nested-gallery,instagram-post,instagram-video,instagram-gallery,instagram-likes,facebook,twitter,pinterest,frame-expand,frame-minimize,archive,colors-typography,custom,footer,header,layout-settings,lightbox-expand,error-404,theme-style,search-results,single-post,site-identity,theme-builder,download-bold,share-arrow,global-settings,user-preferences,lock,export-kit,import-kit,lottie,products-archive,single-product,disable-trash-o,single-page,wordpress-light,cogs-check,custom-css,global-colors,globe,typography-1,background,device-responsive,device-wide,code-highlight,video-playlist,download-kit,kit-details,kit-parts,kit-upload,kit-plugins,kit-upload-alt,hotspot,paypal-button,shape,wordart,checkout,container,flip,info,my-account,purchase-summary,page-transition,spotify,stripe-button,woo-settings,woo-cart,grow,order-end,nowrap,order-start,progress-tracker,shrink,wrap,align-center-h,align-center-v,align-end-h,align-end-v,align-start-h,align-start-v,align-stretch-h,align-stretch-v,justify-center-h,justify-center-v,justify-end-h,justify-end-v,justify-space-around-h,justify-space-around-v,justify-space-between-h,justify-space-between-v,justify-space-evenly-h,justify-space-evenly-v,justify-start-h,justify-start-v,woocommerce-cross-sells,woocommerce-notices,inner-container,warning-full,exit,loop-builder,notes,read,unread|}';",
"\t}",
"",
"\tpublic function get_categories() {",
"\t\treturn ['${4|components,headers|}'];",
"\t}",
"",
"\tprotected function register_controls() {",
"\t\t\\$this->start_controls_section('content', [",
"\t\t\t'label' => __('Content', '${5}'),",
"\t\t\t'type' => Controls_Manager::TAB_CONTENT,",
"\t\t]);",
"",
"\t\t${0}",
"",
"\t\t\\$this->end_controls_section();",
"",
"\t\t\\$this->addSpacerControls();",
"\t}",
"",
"\tprotected function render() {",
"\t\t\\$settings = \\$this->get_settings();",
"",
"\t?>",
"",
"\t\t<div class=\"<?= \\$this->getTopSpacer() . ' ' . \\$this->getBottomSpacer() ?>\">",
"",
"\t\t</div>",
"",
"\t<?php",
"",
"\t}",
"}"
],
"description": "PHP Elementor Template"
},
"Elementor Text": {
"scope": "php",
"prefix": "e-text",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::TEXT,",
"\t'label_block' => true",
"]);"
],
},
"Elementor Textarea": {
"scope": "php",
"prefix": "e-textarea",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::TEXTAREA,",
"\t'label_block' => true",
"]);"
],
},
"Elementor WYSIWYG": {
"scope": "php",
"prefix": "e-wysiwyg",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::WYSIWYG,",
"\t'label_block' => true",
"]);"
],
},
"Elementor Switcher": {
"scope": "php",
"prefix": "e-switcher",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::SWITCHER,",
"\t'label_on' => __('${4:On}', '${3}'),",
"\t'label_off' => __('${5:Off}', '${3}'),",
"\t'default' => '${6:on}',",
"\t'return_value' => '${6}',",
"]);"
],
},
"Elementor Select": {
"scope": "php",
"prefix": "e-select",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::SELECT,",
"\t'options' => [",
"\t\t'${4}' => __('${4/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t\t'${5}' => __('${5/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t],",
"\t'default' => '${4}',",
"\t'label_block' => true",
"]);"
],
},
"Elementor Choose": {
"scope": "php",
"prefix": "e-choose",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::CHOOSE,",
"\t'options' => [",
"\t\t'${4:left}' => [",
"\t\t\t'title' => __('${4/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t\t\t'icon' => 'eicon-${5:arrow-left}',",
"\t\t],",
"\t\t'${6:right}' => [",
"\t\t\t'title' => __('${6/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t\t\t'icon' => 'eicon-${7:arrow-right}',",
"\t\t],",
"\t],",
"\t'default' => '${4}',",
"\t'toggle' => true,",
"\t'label_block' => true",
"]);"
],
},
"Elementor Repeater": {
"scope": "php",
"prefix": "e-repeater",
"body": [
"\\$${1|this,repeater|}->add_control('${2:items}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::REPEATER,",
"\t'prevent_empty' => true,",
"\t'fields' => \\$repeater->get_controls(),",
"\t'label_block' => true,",
"\t'title_field' => '{{{ ${4:title} }}}'",
"]);"
],
},
"Elementor URL": {
"scope": "php",
"prefix": "e-url",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::URL,",
"\t'label_block' => true",
"]);"
],
},
"Elementor Media": {
"scope": "php",
"prefix": "e-media",
"body": [
"\\$${1|this,repeater|}->add_control('${2}', [",
"\t'label' => __('${2/(^|[_-])([^_-]+)/${1:+ }${2:/capitalize}/g}', '${3}'),",
"\t'type' => Controls_Manager::MEDIA,",
"\t'description' => __('Minimum size: ${4}', '${3}'),",
"\t'label_block' => true",
"]);"
],
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment