Skip to content

Instantly share code, notes, and snippets.

@james0r
Created April 14, 2020 05:58
Show Gist options
  • Save james0r/fafc323e0b440e245b135dca21383d25 to your computer and use it in GitHub Desktop.
Save james0r/fafc323e0b440e245b135dca21383d25 to your computer and use it in GitHub Desktop.
Carbon Fields Getter Functions VS Code Snippet
{
"Carbon Fields Get User Meta": {
"prefix": "carbongetusermeta",
"body": [
"carbon_get_user_meta( get_the_author_meta( 'ID' ), 'crb_${1:field name}' )"
],
"description": "Carbon Fields Get User Meta"
},
"Carbon Fields Get Post Meta": {
"prefix": "carbongetpostmeta",
"body": [
"carbon_get_post_meta( ${1:id}, ${2:name} )"
],
"description": "Carbon Fields Get Post Meta"
},
"Carbon Fields Get The Post Meta (in loop)": {
"prefix": "carbongetthepostmeta",
"body": [
"carbon_get_the_post_meta( ${1:name})"
],
"description": "Carbon Fields Get The Post Meta (in loop)"
},
"Carbon Fields Query": {
"prefix": "carbonquery",
"body": [
"$query = new WP_Query( array(",
" 'post_type'=>'post',",
" 'meta_query'=>array(",
" array(",
" 'key' => '${1:crb_text}',",
" 'value' => '${2:hello world}',",
" ),",
" ),",
") );"
],
"description": "Carbon Fields Query"
},
"Carbon Fields Get Theme Option": {
"prefix": "carbongetthemeoption",
"body": [
"carbon_get_theme_option( ${1:name} )"
],
"description": "Carbon Fields Get Theme Option"
},
"Carbon Fields Get Term Meta": {
"prefix": "cargongettermmeta",
"body": [
"carbon_get_term_meta( ${1:term id}, ${2:name} )"
],
"description": "Carbon Fields Get Term Meta"
},
"Carbon Fields Get Comment Meta": {
"prefix": "carbongetcommentmeta",
"body": [
"carbon_get_comment_meta( ${1:comment_id}, ${1:name} )"
],
"description": "Carbon Fields Get Comment Meta"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment