本文整理汇总了PHP中Roots\Sage\Config\display_sidebar函数的典型用法代码示例。如果您正苦于以下问题:PHP display_sidebar函数的具体用法?PHP display_sidebar怎么用?PHP display_sidebar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_sidebar函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: body_class
/**
* Add <body> classes
*/
function body_class($classes)
{
// Add page slug if it doesn't exist
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
}
// Add class if sidebar is active
if (Config\display_sidebar()) {
$classes[] = 'sidebar-primary';
}
return $classes;
}
示例2: body_class
/**
* Add <body> classes
*/
function body_class($classes)
{
// Add page slug if it doesn't exist
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
// Add species tax-slug to body to highlight proper item in left nav
if (get_post_type() == 'strategy_species') {
$custom_terms = get_the_terms(0, 'species');
if ($custom_terms) {
foreach ($custom_terms as $custom_term) {
$classes[] = 'tax-species-' . $custom_term->slug;
}
}
}
}
// Add class if sidebar is active
if (Config\display_sidebar()) {
$classes[] = 'has-sidebar';
}
return $classes;
}
示例3:
<!--[if lt IE 9]>
<div class="alert alert-warning">
<?php
_e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage');
?>
</div>
<![endif]-->
<?php
do_action('get_header');
get_template_part('templates/header');
?>
<div class="wrap" role="document">
<div class="container">
<div class="row">
<?php
if (Config\display_sidebar()) {
?>
<aside class="sidebar" role="complementary">
<?php
include Wrapper\sidebar_path();
?>
</aside><!-- .sidebar -->
<?php
}
?>
<main class="col-sm-10 col-sm-offset-1" role="main">
<?php
include Wrapper\template_path();
?>
<?php
get_template_part('templates/popups');
示例4:
if (!is_page_template('template-campaign.php')) {
?>
<main class="main" role="main">
<?php
} else {
?>
<main class="">
<?php
}
?>
<?php
include Wrapper\template_path();
?>
</main><!-- /.main -->
<?php
if (Config\display_sidebar() && !is_page_template('template-campaign.php')) {
?>
<aside class="sidebar" role="complementary">
<?php
include Wrapper\sidebar_path();
?>
</aside><!-- /.sidebar -->
<?php
}
?>
</div><!-- /.content -->
</div><!-- /.wrap -->
<?php
do_action('get_footer');
get_template_part('templates/footer');
wp_footer();