layers_get_theme_mod

The Layers layers get theme mod function.

Description

layers_get_theme_mod( (string) $name = '', (bool) $allow_empty = true ); 

Parameters (2)

0. $name — Optional. (string) => ''
The name.
1. $allow_empty — Optional. (bool) => true
The allow empty.

Usage

  1. if ( !function_exists( 'layers_get_theme_mod' ) ) { 
  2. require_once '/core/helpers/template.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // The allow empty. 
  8. $allow_empty = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = layers_get_theme_mod($name, $allow_empty); 
  12.  

Defined (1)

The function is defined in the following location(s).

/core/helpers/template.php  
  1. function layers_get_theme_mod( $name = '', $allow_empty = TRUE ) { 
  2.  
  3. global $layers_customizer_defaults; 
  4.  
  5. // Add the theme prefix to our layers option 
  6. $name = LAYERS_THEME_SLUG . '-' . $name; 
  7.  
  8. // Set theme option default 
  9. $default = ( isset( $layers_customizer_defaults[ $name ][ 'value' ] ) ? $layers_customizer_defaults[ $name ][ 'value' ] : FALSE ); 
  10.  
  11. // Get theme option 
  12. $theme_mod = get_theme_mod( $name, $default ); 
  13.  
  14. // Template can choose whether to allow empty 
  15. if ( '' == $theme_mod && FALSE == $allow_empty && FALSE != $default ) { 
  16. $theme_mod = $default; 
  17.  
  18. // Return theme option 
  19. return $theme_mod;