Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Old question, but it came up in my google search for the same info. Finishing off Krike's answer, it is indeed <code>get_theme_mod()</code></p> <p>You can see it at work in the default <code>wp-head-callback</code>. </p> <pre><code>/** * Default custom background callback. * * @since 3.0.0 * @access protected */ function _custom_background_cb() { // $background is the saved custom image, or the default image. $background = set_url_scheme( get_background_image() ); // $color is the saved custom color. // A default has to be specified in style.css. It will not be printed here. $color = get_theme_mod( 'background_color' ); if ( ! $background &amp;&amp; ! $color ) return; $style = $color ? "background-color: #$color;" : ''; if ( $background ) { $image = " background-image: url('$background');"; $repeat = get_theme_mod( 'background_repeat', 'repeat' ); if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) $repeat = 'repeat'; $repeat = " background-repeat: $repeat;"; $position = get_theme_mod( 'background_position_x', 'left' ); if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) $position = 'left'; $position = " background-position: top $position;"; $attachment = get_theme_mod( 'background_attachment', 'scroll' ); if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) $attachment = 'scroll'; $attachment = " background-attachment: $attachment;"; $style .= $image . $repeat . $position . $attachment; } ?&gt; &lt;style type="text/css" id="custom-background-css"&gt; body.custom-background { &lt;?php echo trim( $style ); ?&gt; } &lt;/style&gt; &lt;?php } </code></pre> <p>So you'd get the repeat, position and attachment like so:</p> <pre><code>$repeat = get_theme_mod( 'background_repeat', 'repeat' ); $position = get_theme_mod( 'background_position_x', 'left' ); $attachment = get_theme_mod( 'background_attachment', 'scroll' ); </code></pre> <p>I assume the second parameter is the default.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload