get_theme_mod

Definition:
function get_theme_mod( $name, $default = false ) {}

Retrieve theme modification value for the current theme.
If the modification name does not exist, then the $default will be passed through sprintf() PHP function with the first string the template directory URI and the second string the stylesheet directory URI.

Parameters

  • string $name: Theme modification name.
  • bool|string $default

Defined filters

  • theme_mod_$name
    apply_filters( "theme_mod_$name", $mods[ $name ] )
  • theme_mod_$name
    apply_filters( "theme_mod_$name", sprintf( $default, get_template_directory_uri()

Source code

function get_theme_mod( $name, $default = false ) {

	$mods = get_theme_mods();



	if ( isset( $mods[ $name ] ) )

		return apply_filters( "theme_mod_$name", $mods[ $name ] );



	return apply_filters( "theme_mod_$name", sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ) );

}

1771

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: