示例#1
0
文件: css.php 项目: kadimi/bootswatch
/**
 * Adds inline CSS in header.
 */
function bootswatch_css()
{
    $css = '';
    /**
     * Fix overlapping with WordPress admin bar.
     */
    $css .= 'body.admin-bar .navbar-fixed-top{ top: 32px; }';
    /**
     * Fix overlapping with Bootstrap's fixed navbar.
     */
    if (bootswatch_use('fixed_navbar')) {
        $variables_path = bootswatch_get_option('theme') ? get_template_directory() . '/vendor/thomaspark/bootswatch/' . bootswatch_get_option('theme') . '/variables.less' : get_template_directory() . '/vendor/thomaspark/bootswatch/bower_components/bootstrap/less/variables.less';
        $less_parser = new Less_Parser();
        $less_parser->parseFile($variables_path, home_url());
        $less_parser->parse('body { padding-top: (@navbar-height + @navbar-margin-bottom); }');
        $css .= $less_parser->getCss();
    }
    printf('<style>%s</style>', $css);
    // WPCS: xss ok.
}
示例#2
0
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="<?php 
echo esc_url(home_url());
?>
"><?php 
bloginfo('name');
?>
</a>
				</div>
				<div class="collapse navbar-collapse">
					<?php 
wp_nav_menu(array('theme_location' => 'primary', 'container' => false, 'menu_class' => 'nav navbar-nav' . (!bootswatch_use('search_form_in_header') ? ' navbar-right' : ''), 'walker' => new Bootswatch_Nav_Walker(), 'fallback_cb' => false, 'depth' => 2));
?>
					<?php 
if (bootswatch_use('search_form_in_header')) {
    bootswatch_search_form('navbar-form pull-right');
}
?>
				</div>
			</div>
		</nav>

		<?php 
do_action('bootswatch_after_nav');
?>
	</header>