/**
 * Registers the theme setting controls with the Theme Customizer
 * 
 * @author	Konstantin Obenland
 * @since	1.4.0 - 05.05.2012
 * 
 * @param	WP_Customize	$wp_customize
 * 
 * @return	void
 */
function the_bootstrap_customize_register($wp_customize)
{
    $wp_customize->add_section('the_bootstrap_theme_options', array('title' => __('Theme Options', 'the-bootstrap'), 'priority' => 99));
    // Add settings
    foreach (array_keys(the_bootstrap_get_default_theme_options()) as $setting) {
        $wp_customize->add_setting("the_bootstrap_theme_options[{$setting}]", array('default' => the_bootstrap_options()->{$setting}, 'type' => 'option', 'transport' => 'postMessage'));
    }
    // Theme Layout
    $wp_customize->add_control('the_bootstrap_theme_layout', array('label' => __('Default Layout', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[theme_layout]', 'type' => 'radio', 'choices' => array('content-sidebar' => __('Content on left', 'the-bootstrap'), 'sidebar-content' => __('Content on right', 'the-bootstrap'))));
    // Sitename in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_site_name', array('label' => __('Add site name to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_site_name]', 'type' => 'checkbox'));
    // Searchform in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_searchform', array('label' => __('Add searchform to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_searchform]', 'type' => 'checkbox'));
    // Navbar Position
    $wp_customize->add_control('the_bootstrap_navbar_position', array('label' => __('Navigation Bar Position', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_position]', 'type' => 'radio', 'choices' => array('static' => __('Static.', 'the-bootstrap'), 'navbar-fixed-top' => __('Fixed on top.', 'the-bootstrap'), 'navbar-fixed-bottom' => __('Fixed at bottom.', 'the-bootstrap'))));
}
/**
 * Registers the theme setting controls with the Theme Customizer
 * 
 * @author	Konstantin Obenland
 * @since	1.4.0 - 05.05.2012
 * 
 * @param	WP_Customize	$wp_customize
 * 
 * @return	void
 */
function the_bootstrap_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->add_section('the_bootstrap_theme_layout', array('title' => __('Layout', 'the-bootstrap'), 'priority' => 99));
    $wp_customize->add_section('the_bootstrap_navbar_options', array('title' => __('Navbar Options', 'the-bootstrap'), 'priority' => 101));
    // Add settings
    foreach (array_keys(the_bootstrap_get_default_theme_options()) as $setting) {
        $wp_customize->add_setting("the_bootstrap_theme_options[{$setting}]", array('default' => the_bootstrap_options()->{$setting}, 'type' => 'option', 'transport' => 'postMessage'));
    }
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_background_color', array('default' => '#FFFFFF', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_menu_color', array('default' => '#1B1B1B', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_title_align', array('default' => '#left', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_menu_align', array('default' => '#left', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_sidebar', array('default' => 'true', 'transport' => 'refresh'));
    // Theme Layout
    $wp_customize->add_control('the_bootstrap_theme_layout', array('label' => __('Default Layout', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_layout', 'settings' => 'the_bootstrap_theme_options[theme_layout]', 'type' => 'radio', 'choices' => array('content-sidebar' => __('Content on left', 'the-bootstrap'), 'sidebar-content' => __('Content on right', 'the-bootstrap'))));
    // Sitename in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_site_name', array('label' => __('Add site name to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_site_name]', 'type' => 'checkbox'));
    // Searchform in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_searchform', array('label' => __('Add searchform to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_searchform]', 'type' => 'checkbox'));
    // Navbar Colors
    $wp_customize->add_control('the_bootstrap_navbar_inverse', array('label' => __('Use inverse color on navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_inverse]', 'type' => 'checkbox'));
    // Navbar Position
    $wp_customize->add_control('the_bootstrap_navbar_position', array('label' => __('Navigation Bar Position', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_position]', 'type' => 'radio', 'choices' => array('static' => __('Static.', 'the-bootstrap'), 'navbar-fixed-top' => __('Fixed on top.', 'the-bootstrap'), 'navbar-fixed-bottom' => __('Fixed at bottom.', 'the-bootstrap'))));
    // New special control <ir> ##########################################################
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Color del fondo', 'the_bootstrap'), 'section' => 'colors', 'settings' => 'special_background_color')));
    // New special control <ir> ##########################################################
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color2', array('label' => __('Color del menú', 'the_bootstrap'), 'section' => 'colors', 'settings' => 'special_menu_color')));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_title_align', array('choices' => array('left' => 'Izquierda', 'center' => 'Centrar', 'right' => 'Derecha'), 'label' => __('Alineación del título'), 'section' => 'title_tagline', 'type' => 'select'));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_menu_align', array('choices' => array('left' => 'Izquierda', 'center' => 'Centrar', 'right' => 'Derecha'), 'label' => __('Alineación del menú principal'), 'section' => 'the_bootstrap_navbar_options', 'type' => 'select'));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_sidebar', array('label' => __('Barra lateral'), 'section' => 'the_bootstrap_theme_layout', 'type' => 'checkbox'));
}
/**
 * Properly enqueue frontend styles
 *
 * Since 'tw-bootstrap' was registered as a dependency, it'll get enqueued
 * automatically
 *
 * @author	Konstantin Obenland
 * @since	1.0.0 - 05.02.2012
 *
 * @return	void
 */
function the_bootstrap_print_styles()
{
    if (is_child_theme()) {
        wp_enqueue_style('the-bootstrap-child', get_stylesheet_uri(), array('the-bootstrap'));
    } else {
        wp_enqueue_style('the-bootstrap');
    }
    //wp_enqueue_style('the-fonts');
    if ('static' != the_bootstrap_options()->navbar_position) {
        $top_bottom = str_replace('navbar-fixed-', '', the_bootstrap_options()->navbar_position);
        $css = "body > .container{margin-{$top_bottom}:68px;}@media(min-width: 980px){body > .container{margin-{$top_bottom}:58px;}}";
        if (is_admin_bar_showing() and 'top' == $top_bottom) {
            $css .= '.navbar.navbar-fixed-top{margin-top:28px;}';
        }
        if (function_exists('wp_add_inline_style')) {
            wp_add_inline_style('the-bootstrap', $css);
        } else {
            echo "<style type='text/css'>\n{$css}\n</style>\n";
        }
    }
}
/**
 * Adds The Bootstrap layout classes to the array of body classes.
 *
 * @author	WordPress.org
 * @since	1.3.0 - 06.04.2012
 * 
 * @return	void
 */
function the_bootstrap_layout_classes($existing_classes)
{
    $classes = array(the_bootstrap_options()->theme_layout);
    $classes = apply_filters('the_bootstrap_layout_classes', $classes);
    return array_merge($existing_classes, $classes);
}
示例#5
0
										<span class="icon-bar"></span>
									</a>
									<?php 
    if (the_bootstrap_options()->navbar_site_name) {
        ?>
									<span class="brand"><?php 
        bloginfo('name');
        ?>
</span>
									<?php 
    }
    ?>
									<div class="nav-collapse">
										<?php 
    wp_nav_menu(array('theme_location' => 'primary', 'menu_class' => 'nav', 'depth' => 3, 'fallback_cb' => false, 'walker' => new The_Bootstrap_Nav_Walker()));
    if (the_bootstrap_options()->navbar_searchform) {
        the_bootstrap_navbar_searchform();
    }
    ?>
								    </div>
								</div>
							</div>
						</div>
						<?php 
}
?>
					</nav><!-- #access -->
					<?php 
if (function_exists('yoast_breadcrumb')) {
    yoast_breadcrumb('<nav id="breadcrumb" class="breadcrumb">', '</nav>');
}
示例#6
0
 /**
  * Adds The Bootstrap navbar classes
  *
  * @author	WordPress.org
  * @since	1.4.0 - 12.05.2012
  *
  * @return	void
  */
 function the_bootstrap_navbar_class()
 {
     $classes = array('navbar');
     if ('static' != the_bootstrap_options()->navbar_position) {
         $classes[] = the_bootstrap_options()->navbar_position;
     }
     if (the_bootstrap_options()->navbar_inverse) {
         $classes[] = 'navbar-inverse';
     }
     apply_filters('the_bootstrap_navbar_classes', $classes);
     echo 'class="' . join(' ', $classes) . '"';
 }
/**
 * @return	void
 */
function the_bootstrap_settings_field_radio( $args ) {
	extract( wp_parse_args( $args, array(
		'name'		=>	null,
		'options'	=>	array(),
	) ) );

	foreach ( (array) $options as $o ) : ?>
		<label for="<?php echo sanitize_title_with_dashes( $o->value ); ?>">
			<input type="radio" name="the_bootstrap_theme_options[<?php echo esc_attr( $name ); ?>]" id="<?php echo sanitize_title_with_dashes( $o->value ); ?>" value="<?php echo esc_attr( $o->value ); ?>" <?php checked( $o->value, the_bootstrap_options()->$name ); ?> />
			<?php if ( isset( $o->description ) ) echo $o->description; ?>
		</label><br />
	<?php endforeach;

}