Created
November 19, 2013 17:13
-
-
Save natejacobson/7548847 to your computer and use it in GitHub Desktop.
Is there a way to do this with one command? Can I echo the specified array item without fetching the array first? These are coming from new customization options setup with $wp_customize. It is working, I'd just like to shorten.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $spine_color = get_option( 'spine_theme_options' ); echo $spine_color['grid_style']; ?> |
It likely won't cause any issues, though it is best practice to continue checking. Data pulled from the database cannot be trusted in similar ways that data inputted by a user cannot be trusted. Operating under the assumption that it somehow disappeared would be good.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Come to think of it, $wp_customize does expect defaults to be set up, so that default will always be in place. For example,
$wp_customize->add_setting('spine_theme_options[spine_color]', array(
'default' => 'white',
'capability' => 'edit_theme_options',
'type' => 'option',
Which also means, I don't need to worry about the other call degrading gracefully, right?