1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Background Field

Background Field

Arguments for Background Field

idstring A unique ID. This ID will be used to get the value.
typestringbackgroundType of the field.
titlestring Title of the field.
defaultarray Default value to return if the option does not exist in the database
subtitlestring Subtitle to display below the title.
descstring Description to display after the field.
helpstring Text to display on right-corner (as hover / popup) the field.
classstring Extra CSS classes (space separated) to append to the field.
beforestring Content to display before the field.
afterstring Content to display after the field.
dependencyarray Define field visibility depending on other field value.
attributesarray Extra HTML attributes to append to the field.
sanitizestring Callback function for sanitizing value.
validatestring Callback function for validating value.
background_colorbooltrueFlag to display background-color of the field
background_imagebooltrueFlag to display background-image of the field
background_positionbooltrueFlag to display background-position of the field
background_repeatbooltrueFlag to display background-repeat of the field
background_attachmentbooltrueFlag to display background-attachment of the field
background_sizebooltrueFlag to display background-size of the field
background-originboolfalseFlag to display background-origin of the field
background-clipboolfalseFlag to display background-clip of the field
background_blend_modeboolfalseFlag to display background blend mode of the field
background_gradientboolfalseFlag to display background-gradient of the field.
background_image_previewbooltrueFlag to display background-image-preview of the field
outputarray|string CSS elements selector
output_importantboolfalseFlat to add !important rule on output css

Default Arguments

background-colorstringHex string representing the default background color (#ffbc00, rgba(255,0,0,0.25)
background-positionstringString representing the default background position value. ( left top left center left bottom center top center center center bottom right top right center right bottom)
background-repeatstringString representing the default background repeat value. ( repeat repeat-x repeat-y no-repeat)
background-attachmentstringString representing the default background attachment value. ( scroll fixed)
background-sizestringString representing the default background size value (cover contain)
background-originstringString representing the default background origin value ( padding-box border-box content-box)
background-clipstringString representing the default background clip value ( padding-box border-box content-box)
background-blend-modestringString representing the default background blend mode value ( normal multiply screen overlay darken lighten color-dodge saturation color luminosity)
background-gradient-colorstringString representing the default gradient color value ( #ffbc00, rgba(255,0,0,0.25) )
background-gradient-directionstringString representing the default gradient direction value ( to bottom to right 135deg -135deg)

Simple Background Field Example

  'id' => 'example-background',
  'type' => 'background',
  'title' => 'Example Background',

Advanced Background Field Example

  'id' => 'example-background',
  'type' => 'background',
  'title' => 'Example Background',
  'background_gradient' => true,
  'background_origin' => true,
  'background_clip' => true,
  'background_blend_mode' => true,
  'default' => array(
    'background-color' => '#111111',
    'background-gradient-color' => '#555555',
    'background-gradient-direction' => 'to bottom',
    'background-size' => 'cover',
    'background-position' => 'center center',
    'background-repeat' => 'repeat',
Was this article helpful to you? Yes No

How can we help?