PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/twentyeleven/inc/theme-options.php

https://github.com/davodey/WordPress
PHP | 586 lines | 319 code | 62 blank | 205 comment | 20 complexity | b2865b7c7b947f9361761affa489414c MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Twenty Eleven Theme Options
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Eleven
  7. * @since Twenty Eleven 1.0
  8. */
  9. /**
  10. * Properly enqueue styles and scripts for our theme options page.
  11. *
  12. * This function is attached to the admin_enqueue_scripts action hook.
  13. *
  14. * @since Twenty Eleven 1.0
  15. *
  16. * @param string $hook_suffix An admin page's hook suffix.
  17. */
  18. function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
  19. wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
  20. wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
  21. wp_enqueue_style( 'farbtastic' );
  22. }
  23. add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
  24. /**
  25. * Register the form setting for our twentyeleven_options array.
  26. *
  27. * This function is attached to the admin_init action hook.
  28. *
  29. * This call to register_setting() registers a validation callback, twentyeleven_theme_options_validate(),
  30. * which is used when the option is saved, to ensure that our option values are complete, properly
  31. * formatted, and safe.
  32. *
  33. * @since Twenty Eleven 1.0
  34. */
  35. function twentyeleven_theme_options_init() {
  36. register_setting(
  37. 'twentyeleven_options', // Options group, see settings_fields() call in twentyeleven_theme_options_render_page()
  38. 'twentyeleven_theme_options', // Database option, see twentyeleven_get_theme_options()
  39. 'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate()
  40. );
  41. // Register our settings field group
  42. add_settings_section(
  43. 'general', // Unique identifier for the settings section
  44. '', // Section title (we don't want one)
  45. '__return_false', // Section callback (we don't want anything)
  46. 'theme_options' // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
  47. );
  48. // Register our individual settings fields
  49. add_settings_field(
  50. 'color_scheme', // Unique identifier for the field for this section
  51. __( 'Color Scheme', 'twentyeleven' ), // Setting field label
  52. 'twentyeleven_settings_field_color_scheme', // Function that renders the settings field
  53. 'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
  54. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  55. );
  56. add_settings_field( 'link_color', __( 'Link Color', 'twentyeleven' ), 'twentyeleven_settings_field_link_color', 'theme_options', 'general' );
  57. add_settings_field( 'layout', __( 'Default Layout', 'twentyeleven' ), 'twentyeleven_settings_field_layout', 'theme_options', 'general' );
  58. }
  59. add_action( 'admin_init', 'twentyeleven_theme_options_init' );
  60. /**
  61. * Change the capability required to save the 'twentyeleven_options' options group.
  62. *
  63. * @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.
  64. * @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
  65. *
  66. * By default, the options groups for all registered settings require the manage_options capability.
  67. * This filter is required to change our theme options page to edit_theme_options instead.
  68. * By default, only administrators have either of these capabilities, but the desire here is
  69. * to allow for finer-grained control for roles and users.
  70. *
  71. * @param string $capability The capability used for the page, which is manage_options by default.
  72. * @return string The capability to actually use.
  73. */
  74. function twentyeleven_option_page_capability( $capability ) {
  75. return 'edit_theme_options';
  76. }
  77. add_filter( 'option_page_capability_twentyeleven_options', 'twentyeleven_option_page_capability' );
  78. /**
  79. * Add a theme options page to the admin menu, including some help documentation.
  80. *
  81. * This function is attached to the admin_menu action hook.
  82. *
  83. * @since Twenty Eleven 1.0
  84. */
  85. function twentyeleven_theme_options_add_page() {
  86. $theme_page = add_theme_page(
  87. __( 'Theme Options', 'twentyeleven' ), // Name of page
  88. __( 'Theme Options', 'twentyeleven' ), // Label in menu
  89. 'edit_theme_options', // Capability required
  90. 'theme_options', // Menu slug, used to uniquely identify the page
  91. 'twentyeleven_theme_options_render_page' // Function that renders the options page
  92. );
  93. if ( ! $theme_page )
  94. return;
  95. add_action( "load-$theme_page", 'twentyeleven_theme_options_help' );
  96. }
  97. add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' );
  98. function twentyeleven_theme_options_help() {
  99. $help = '<p>' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '</p>' .
  100. '<ol>' .
  101. '<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '</li>' .
  102. '<li>' . __( '<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'twentyeleven' ) . '</li>' .
  103. '<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site&#8217;s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '</li>' .
  104. '</ol>' .
  105. '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>';
  106. $sidebar = '<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' .
  107. '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'twentyeleven' ) . '</p>' .
  108. '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>';
  109. $screen = get_current_screen();
  110. if ( method_exists( $screen, 'add_help_tab' ) ) {
  111. // WordPress 3.3.0
  112. $screen->add_help_tab( array(
  113. 'title' => __( 'Overview', 'twentyeleven' ),
  114. 'id' => 'theme-options-help',
  115. 'content' => $help,
  116. )
  117. );
  118. $screen->set_help_sidebar( $sidebar );
  119. } else {
  120. // WordPress 3.2.0
  121. add_contextual_help( $screen, $help . $sidebar );
  122. }
  123. }
  124. /**
  125. * Return an array of color schemes registered for Twenty Eleven.
  126. *
  127. * @since Twenty Eleven 1.0
  128. */
  129. function twentyeleven_color_schemes() {
  130. $color_scheme_options = array(
  131. 'light' => array(
  132. 'value' => 'light',
  133. 'label' => __( 'Light', 'twentyeleven' ),
  134. 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',
  135. 'default_link_color' => '#1b8be0',
  136. ),
  137. 'dark' => array(
  138. 'value' => 'dark',
  139. 'label' => __( 'Dark', 'twentyeleven' ),
  140. 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',
  141. 'default_link_color' => '#e4741f',
  142. ),
  143. );
  144. /**
  145. * Filter the Twenty Eleven color scheme options.
  146. *
  147. * @since Twenty Eleven 1.0
  148. *
  149. * @param array $color_scheme_options An associative array of color scheme options.
  150. */
  151. return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options );
  152. }
  153. /**
  154. * Return an array of layout options registered for Twenty Eleven.
  155. *
  156. * @since Twenty Eleven 1.0
  157. */
  158. function twentyeleven_layouts() {
  159. $layout_options = array(
  160. 'content-sidebar' => array(
  161. 'value' => 'content-sidebar',
  162. 'label' => __( 'Content on left', 'twentyeleven' ),
  163. 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png',
  164. ),
  165. 'sidebar-content' => array(
  166. 'value' => 'sidebar-content',
  167. 'label' => __( 'Content on right', 'twentyeleven' ),
  168. 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png',
  169. ),
  170. 'content' => array(
  171. 'value' => 'content',
  172. 'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
  173. 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
  174. ),
  175. );
  176. /**
  177. * Filter the Twenty Eleven layout options.
  178. *
  179. * @since Twenty Eleven 1.0
  180. *
  181. * @param array $layout_options An associative array of layout options.
  182. */
  183. return apply_filters( 'twentyeleven_layouts', $layout_options );
  184. }
  185. /**
  186. * Return the default options for Twenty Eleven.
  187. *
  188. * @since Twenty Eleven 1.0
  189. *
  190. * @return array An array of default theme options.
  191. */
  192. function twentyeleven_get_default_theme_options() {
  193. $default_theme_options = array(
  194. 'color_scheme' => 'light',
  195. 'link_color' => twentyeleven_get_default_link_color( 'light' ),
  196. 'theme_layout' => 'content-sidebar',
  197. );
  198. if ( is_rtl() )
  199. $default_theme_options['theme_layout'] = 'sidebar-content';
  200. /**
  201. * Filter the Twenty Eleven default options.
  202. *
  203. * @since Twenty Eleven 1.0
  204. *
  205. * @param array $default_theme_options An array of default theme options.
  206. */
  207. return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options );
  208. }
  209. /**
  210. * Return the default link color for Twenty Eleven, based on color scheme.
  211. *
  212. * @since Twenty Eleven 1.0
  213. *
  214. * @param string $color_scheme Optional. Color scheme.
  215. * Default null (or the active color scheme).
  216. * @return string The default link color.
  217. */
  218. function twentyeleven_get_default_link_color( $color_scheme = null ) {
  219. if ( null === $color_scheme ) {
  220. $options = twentyeleven_get_theme_options();
  221. $color_scheme = $options['color_scheme'];
  222. }
  223. $color_schemes = twentyeleven_color_schemes();
  224. if ( ! isset( $color_schemes[ $color_scheme ] ) )
  225. return false;
  226. return $color_schemes[ $color_scheme ]['default_link_color'];
  227. }
  228. /**
  229. * Return the options array for Twenty Eleven.
  230. *
  231. * @since Twenty Eleven 1.0
  232. */
  233. function twentyeleven_get_theme_options() {
  234. return get_option( 'twentyeleven_theme_options', twentyeleven_get_default_theme_options() );
  235. }
  236. /**
  237. * Render the Color Scheme setting field.
  238. *
  239. * @since Twenty Eleven 1.3
  240. */
  241. function twentyeleven_settings_field_color_scheme() {
  242. $options = twentyeleven_get_theme_options();
  243. foreach ( twentyeleven_color_schemes() as $scheme ) {
  244. ?>
  245. <div class="layout image-radio-option color-scheme">
  246. <label class="description">
  247. <input type="radio" name="twentyeleven_theme_options[color_scheme]" value="<?php echo esc_attr( $scheme['value'] ); ?>" <?php checked( $options['color_scheme'], $scheme['value'] ); ?> />
  248. <input type="hidden" id="default-color-<?php echo esc_attr( $scheme['value'] ); ?>" value="<?php echo esc_attr( $scheme['default_link_color'] ); ?>" />
  249. <span>
  250. <img src="<?php echo esc_url( $scheme['thumbnail'] ); ?>" width="136" height="122" alt="" />
  251. <?php echo $scheme['label']; ?>
  252. </span>
  253. </label>
  254. </div>
  255. <?php
  256. }
  257. }
  258. /**
  259. * Render the Link Color setting field.
  260. *
  261. * @since Twenty Eleven 1.3
  262. */
  263. function twentyeleven_settings_field_link_color() {
  264. $options = twentyeleven_get_theme_options();
  265. ?>
  266. <input type="text" name="twentyeleven_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" />
  267. <a href="#" class="pickcolor hide-if-no-js" id="link-color-example"></a>
  268. <input type="button" class="pickcolor button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color', 'twentyeleven' ); ?>" />
  269. <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  270. <br />
  271. <span><?php printf( __( 'Default color: %s', 'twentyeleven' ), '<span id="default-color">' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '</span>' ); ?></span>
  272. <?php
  273. }
  274. /**
  275. * Render the Layout setting field.
  276. *
  277. * @since Twenty Eleven 1.3
  278. */
  279. function twentyeleven_settings_field_layout() {
  280. $options = twentyeleven_get_theme_options();
  281. foreach ( twentyeleven_layouts() as $layout ) {
  282. ?>
  283. <div class="layout image-radio-option theme-layout">
  284. <label class="description">
  285. <input type="radio" name="twentyeleven_theme_options[theme_layout]" value="<?php echo esc_attr( $layout['value'] ); ?>" <?php checked( $options['theme_layout'], $layout['value'] ); ?> />
  286. <span>
  287. <img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" width="136" height="122" alt="" />
  288. <?php echo $layout['label']; ?>
  289. </span>
  290. </label>
  291. </div>
  292. <?php
  293. }
  294. }
  295. /**
  296. * Render the theme options page for Twenty Eleven.
  297. *
  298. * @since Twenty Eleven 1.2
  299. */
  300. function twentyeleven_theme_options_render_page() {
  301. ?>
  302. <div class="wrap">
  303. <?php screen_icon(); ?>
  304. <?php $theme_name = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_current_theme(); ?>
  305. <h2><?php printf( __( '%s Theme Options', 'twentyeleven' ), $theme_name ); ?></h2>
  306. <?php settings_errors(); ?>
  307. <form method="post" action="options.php">
  308. <?php
  309. settings_fields( 'twentyeleven_options' );
  310. do_settings_sections( 'theme_options' );
  311. submit_button();
  312. ?>
  313. </form>
  314. </div>
  315. <?php
  316. }
  317. /**
  318. * Sanitize and validate form input.
  319. *
  320. * Accepts an array, return a sanitized array.
  321. *
  322. * @see twentyeleven_theme_options_init()
  323. * @todo set up Reset Options action
  324. *
  325. * @since Twenty Eleven 1.0
  326. *
  327. * @param array $input An array of form input.
  328. */
  329. function twentyeleven_theme_options_validate( $input ) {
  330. $output = $defaults = twentyeleven_get_default_theme_options();
  331. // Color scheme must be in our array of color scheme options
  332. if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) )
  333. $output['color_scheme'] = $input['color_scheme'];
  334. // Our defaults for the link color may have changed, based on the color scheme.
  335. $output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] );
  336. // Link color must be 3 or 6 hexadecimal characters
  337. if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) )
  338. $output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) );
  339. // Theme layout must be in our array of theme layout options
  340. if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) )
  341. $output['theme_layout'] = $input['theme_layout'];
  342. /**
  343. * Filter the Twenty Eleven sanitized form input array.
  344. *
  345. * @since Twenty Eleven 1.0
  346. *
  347. * @param array $output An array of sanitized form output.
  348. * @param array $input An array of un-sanitized form input.
  349. * @param array $defaults An array of default theme options.
  350. */
  351. return apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults );
  352. }
  353. /**
  354. * Enqueue the styles for the current color scheme.
  355. *
  356. * @since Twenty Eleven 1.0
  357. */
  358. function twentyeleven_enqueue_color_scheme() {
  359. $options = twentyeleven_get_theme_options();
  360. $color_scheme = $options['color_scheme'];
  361. if ( 'dark' == $color_scheme )
  362. wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
  363. /**
  364. * Fires after the styles for the Twenty Eleven color scheme are enqueued.
  365. *
  366. * @since Twenty Eleven 1.0
  367. *
  368. * @param string $color_scheme The color scheme.
  369. */
  370. do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
  371. }
  372. add_action( 'wp_enqueue_scripts', 'twentyeleven_enqueue_color_scheme' );
  373. /**
  374. * Add a style block to the theme for the current link color.
  375. *
  376. * This function is attached to the wp_head action hook.
  377. *
  378. * @since Twenty Eleven 1.0
  379. */
  380. function twentyeleven_print_link_color_style() {
  381. $options = twentyeleven_get_theme_options();
  382. $link_color = $options['link_color'];
  383. $default_options = twentyeleven_get_default_theme_options();
  384. // Don't do anything if the current link color is the default.
  385. if ( $default_options['link_color'] == $link_color )
  386. return;
  387. ?>
  388. <style>
  389. /* Link color */
  390. a,
  391. #site-title a:focus,
  392. #site-title a:hover,
  393. #site-title a:active,
  394. .entry-title a:hover,
  395. .entry-title a:focus,
  396. .entry-title a:active,
  397. .widget_twentyeleven_ephemera .comments-link a:hover,
  398. section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
  399. section.recent-posts .other-recent-posts .comments-link a:hover,
  400. .format-image footer.entry-meta a:hover,
  401. #site-generator a:hover {
  402. color: <?php echo $link_color; ?>;
  403. }
  404. section.recent-posts .other-recent-posts .comments-link a:hover {
  405. border-color: <?php echo $link_color; ?>;
  406. }
  407. article.feature-image.small .entry-summary p a:hover,
  408. .entry-header .comments-link a:hover,
  409. .entry-header .comments-link a:focus,
  410. .entry-header .comments-link a:active,
  411. .feature-slider a.active {
  412. background-color: <?php echo $link_color; ?>;
  413. }
  414. </style>
  415. <?php
  416. }
  417. add_action( 'wp_head', 'twentyeleven_print_link_color_style' );
  418. /**
  419. * Add Twenty Eleven layout classes to the array of body classes.
  420. *
  421. * @since Twenty Eleven 1.0
  422. *
  423. * @param array $existing_classes An array of existing body classes.
  424. */
  425. function twentyeleven_layout_classes( $existing_classes ) {
  426. $options = twentyeleven_get_theme_options();
  427. $current_layout = $options['theme_layout'];
  428. if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) )
  429. $classes = array( 'two-column' );
  430. else
  431. $classes = array( 'one-column' );
  432. if ( 'content-sidebar' == $current_layout )
  433. $classes[] = 'right-sidebar';
  434. elseif ( 'sidebar-content' == $current_layout )
  435. $classes[] = 'left-sidebar';
  436. else
  437. $classes[] = $current_layout;
  438. /**
  439. * Filter the Twenty Eleven layout body classes.
  440. *
  441. * @since Twenty Eleven 1.0
  442. *
  443. * @param array $classes An array of body classes.
  444. * @param string $current_layout The current theme layout.
  445. */
  446. $classes = apply_filters( 'twentyeleven_layout_classes', $classes, $current_layout );
  447. return array_merge( $existing_classes, $classes );
  448. }
  449. add_filter( 'body_class', 'twentyeleven_layout_classes' );
  450. /**
  451. * Implements Twenty Eleven theme options into Theme Customizer
  452. *
  453. * @since Twenty Eleven 1.3
  454. *
  455. * @param object $wp_customize Theme Customizer object.
  456. */
  457. function twentyeleven_customize_register( $wp_customize ) {
  458. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
  459. $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
  460. $options = twentyeleven_get_theme_options();
  461. $defaults = twentyeleven_get_default_theme_options();
  462. $wp_customize->add_setting( 'twentyeleven_theme_options[color_scheme]', array(
  463. 'default' => $defaults['color_scheme'],
  464. 'type' => 'option',
  465. 'capability' => 'edit_theme_options',
  466. ) );
  467. $schemes = twentyeleven_color_schemes();
  468. $choices = array();
  469. foreach ( $schemes as $scheme ) {
  470. $choices[ $scheme['value'] ] = $scheme['label'];
  471. }
  472. $wp_customize->add_control( 'twentyeleven_color_scheme', array(
  473. 'label' => __( 'Color Scheme', 'twentyeleven' ),
  474. 'section' => 'colors',
  475. 'settings' => 'twentyeleven_theme_options[color_scheme]',
  476. 'type' => 'radio',
  477. 'choices' => $choices,
  478. 'priority' => 5,
  479. ) );
  480. // Link Color (added to Color Scheme section in Theme Customizer)
  481. $wp_customize->add_setting( 'twentyeleven_theme_options[link_color]', array(
  482. 'default' => twentyeleven_get_default_link_color( $options['color_scheme'] ),
  483. 'type' => 'option',
  484. 'sanitize_callback' => 'sanitize_hex_color',
  485. 'capability' => 'edit_theme_options',
  486. ) );
  487. $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
  488. 'label' => __( 'Link Color', 'twentyeleven' ),
  489. 'section' => 'colors',
  490. 'settings' => 'twentyeleven_theme_options[link_color]',
  491. ) ) );
  492. // Default Layout
  493. $wp_customize->add_section( 'twentyeleven_layout', array(
  494. 'title' => __( 'Layout', 'twentyeleven' ),
  495. 'priority' => 50,
  496. ) );
  497. $wp_customize->add_setting( 'twentyeleven_theme_options[theme_layout]', array(
  498. 'type' => 'option',
  499. 'default' => $defaults['theme_layout'],
  500. 'sanitize_callback' => 'sanitize_key',
  501. ) );
  502. $layouts = twentyeleven_layouts();
  503. $choices = array();
  504. foreach ( $layouts as $layout ) {
  505. $choices[$layout['value']] = $layout['label'];
  506. }
  507. $wp_customize->add_control( 'twentyeleven_theme_options[theme_layout]', array(
  508. 'section' => 'twentyeleven_layout',
  509. 'type' => 'radio',
  510. 'choices' => $choices,
  511. ) );
  512. }
  513. add_action( 'customize_register', 'twentyeleven_customize_register' );
  514. /**
  515. * Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
  516. *
  517. * Used with blogname and blogdescription.
  518. *
  519. * @since Twenty Eleven 1.3
  520. */
  521. function twentyeleven_customize_preview_js() {
  522. wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
  523. }
  524. add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );