Advertisement
Guest User

My Custom WP Customize

a guest
Feb 3rd, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2. function roots_customize_register( $wp_customize ) {
  3.  
  4.     $wp_customize->add_section( 'roots_theme_section_nav' , array(
  5.         'title'      => __('Navigation Colors','roots'),
  6.     ) );
  7.    
  8.     $wp_customize->add_setting( 'roots_theme_options[nav_bg]' , array(
  9.         'default'     => '#FAFAFA',
  10.     ) );
  11.    
  12.     $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'nav_bg', array(
  13.         'label'        => __( 'Background color', 'roots' ),
  14.         'section'    => 'roots_theme_section_nav',
  15.         'settings'   => 'roots_theme_options[nav_bg]',
  16.     ) ) );
  17.    
  18. }
  19.  
  20. function roots_customize_css() {
  21.     ?>
  22.     <style type="text/css">
  23.      .navbar-inner { background-color:<?php echo get_theme_mod('roots_theme_options[nav_bg]'); ?>; }
  24.     </style>
  25.     <?php
  26. }
  27.  
  28. add_action( 'customize_register', 'roots_customize_register' );
  29. add_action( 'wp_head', 'roots_customize_css');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement