public function get( $args = array(), $assoc_args = array() ) {

		if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
			WP_CLI::error( 'You must specify at least one mod or use --all.' );
		}

		if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) ) {
			$args = array();
		}

		$list = array();
		$mods = get_theme_mods();
		if ( ! is_array( $mods ) ) {
			// if no mods are set (perhaps new theme), make sure foreach still works
			$mods = array();
		}
		foreach ( $mods as $k => $v ) {
			// if mods were given, skip the others
			if ( ! empty( $args ) && ! in_array( $k, $args, true ) ) {
				continue;
			}

			if ( is_array( $v ) ) {
				$list[] = [
					'key'   => $k,
					'value' => '=>',
				];
				foreach ( $v as $_k => $_v ) {
					$list[] = [
						'key'   => "    $_k",
						'value' => $_v,
					];
				}
			} else {
				$list[] = [
					'key'   => $k,
					'value' => $v,
				];
			}
		}

		// For unset mods, show blank value
		foreach ( $args as $mod ) {
			if ( ! isset( $mods[ $mod ] ) ) {
				$list[] = [
					'key'   => $mod,
					'value' => '',
				];
			}
		}

		$formatter = new \WP_CLI\Formatter( $assoc_args, $this->fields, 'thememods' );
		$formatter->display_items( $list );

	}
public function get( $args = array(), $assoc_args = array() ) {

		if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
			WP_CLI::error( 'You must specify at least one mod or use --all.' );
		}

		if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) ) {
			$args = array();
		}

		$list = array();
		$mods = get_theme_mods();
		if ( ! is_array( $mods ) ) {
			// if no mods are set (perhaps new theme), make sure foreach still works
			$mods = array();
		}
		foreach ( $mods as $k => $v ) {
			// if mods were given, skip the others
			if ( ! empty( $args ) && ! in_array( $k, $args, true ) ) {
				continue;
			}

			if ( is_array( $v ) ) {
				$list[] = [
					'key'   => $k,
					'value' => '=>',
				];
				foreach ( $v as $_k => $_v ) {
					$list[] = [
						'key'   => "    $_k",
						'value' => $_v,
					];
				}
			} else {
				$list[] = [
					'key'   => $k,
					'value' => $v,
				];
			}
		}

		// For unset mods, show blank value
		foreach ( $args as $mod ) {
			if ( ! isset( $mods[ $mod ] ) ) {
				$list[] = [
					'key'   => $mod,
					'value' => '',
				];
			}
		}

		$formatter = new \WP_CLI\Formatter( $assoc_args, $this->fields, 'thememods' );
		$formatter->display_items( $list );

	}
public function get ( $ args = array ( ) , $ assoc_args = array ( ) ) { if ( ! \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) && empty ( $ args ) ) { WP_CLI :: error ( 'You must specify at least one mod or use --all.' ) ; } if ( \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) ) { $ args = array ( ) ; } $ list = array ( ) ; $ mods = get_theme_mods ( ) ; if ( ! is_array ( $ mods ) ) { // if no mods are set (perhaps new theme), make sure foreach still works $ mods = array ( ) ; } foreach ( $ mods as $ k => $ v ) { // if mods were given, skip the others if ( ! empty ( $ args ) && ! in_array ( $ k , $ args , true ) ) { continue ; } if ( is_array ( $ v ) ) { $ list [ ] = [ 'key' => $ k , 'value' => '=>' , ] ; foreach ( $ v as $ _k => $ _v ) { $ list [ ] = [ 'key' => "    $_k" , 'value' => $ _v , ] ; } } else { $ list [ ] = [ 'key' => $ k , 'value' => $ v , ] ; } } // For unset mods, show blank value foreach ( $ args as $ mod ) { if ( ! isset ( $ mods [ $ mod ] ) ) { $ list [ ] = [ 'key' => $ mod , 'value' => '' , ] ; } } $ formatter = new \ WP_CLI \ Formatter ( $ assoc_args , $ this -> fields , 'thememods' ) ; $ formatter -> display_items ( $ list ) ; }
Gets one or more theme mods.

## OPTIONS

[<mod>...]
: One or more mods to get.

[--field=<field>]
: Returns the value of a single field.

[--all]
: List all theme mods

[--format=<format>]
: Render output in a particular format.
---
default: table
options:
- table
- json
- csv
- yaml
---

## EXAMPLES

# Get all theme mods.
$ wp theme mod get --all
+------------------+---------+
| key              | value   |
+------------------+---------+
| background_color | dd3333  |
| link_color       | #dd9933 |
| main_text_color  | #8224e3 |
+------------------+---------+

# Get single theme mod in JSON format.
$ wp theme mod get background_color --format=json
[{"key":"background_color","value":"dd3333"}]

# Get value of a single theme mod.
$ wp theme mod get background_color --field=value
dd3333

# Get multiple theme mods.
$ wp theme mod get background_color header_textcolor
+------------------+--------+
| key              | value  |
+------------------+--------+
| background_color | dd3333 |
| header_textcolor |        |
+------------------+--------+
Gets one or more theme mods .