Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save salehahmadbabu/6a4c778596a19a5163e9b02e2cadd7ad to your computer and use it in GitHub Desktop.
Save salehahmadbabu/6a4c778596a19a5163e9b02e2cadd7ad to your computer and use it in GitHub Desktop.
//To set custom snippet in your sublime text go to : Tools>Developer>New Snippet and paste the below code. Save it as named {your filename goes here}.sublime-snippet. Like i saved register sidebar snippet as : register-sidebar.sublime-snippet
// register sidebar widget basic args snippet for sublime text
<snippet>
<content><![CDATA[
register_sidebar(
array(
'name' => __('${1:name}', '${2:textdomain}'),
'id' => '${3:id}',
'description' => __('${4:}', '${5:this}'),
'before_widget' => '<section id="%1\$s" class="widget %2\$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_widget' => '</h2>',
)
);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sidebar</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
//To set custom snippet in your sublime text go to : Tools>Developer>New Snippet and paste the below code. Save it as named {your filename goes here}.sublime-snippet.
// add_action hook snippet
<snippet>
<content><![CDATA[
function ${1:function name}() {
${3:}
}
add_action('${2:}', '${1:function name}');
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>action</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment