本文整理汇总了PHP中is_active_sidebar函数的典型用法代码示例。如果您正苦于以下问题:PHP is_active_sidebar函数的具体用法?PHP is_active_sidebar怎么用?PHP is_active_sidebar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_active_sidebar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: penscratch_has_footer_widgets
function penscratch_has_footer_widgets()
{
if (has_nav_menu('social') || jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
return true;
}
return false;
}
示例2: twentyeleven_footer_sidebar_class
/**
* Count the number of footer sidebars to enable dynamic classes for the footer
*/
function twentyeleven_footer_sidebar_class()
{
$count = 0;
if (is_active_sidebar('sidebar-3')) {
$count++;
}
if (is_active_sidebar('sidebar-4')) {
$count++;
}
if (is_active_sidebar('sidebar-5')) {
$count++;
}
$class = '';
switch ($count) {
case '1':
$class = 'one';
break;
case '2':
$class = 'two';
break;
case '3':
$class = 'three';
break;
}
if ($class) {
echo 'class="' . $class . '"';
}
}
示例3: siteorigin_north_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function siteorigin_north_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
$classes[] = 'no-js';
$classes[] = 'css3-animations';
$classes[] = 'responsive';
if (is_page()) {
$classes[] = 'page-layout-' . SiteOrigin_Settings_Page_Settings::get('layout');
$classes[] = 'page-layout-menu-' . SiteOrigin_Settings_Page_Settings::get('menu');
if (!SiteOrigin_Settings_Page_Settings::get('masthead_margin')) {
$classes[] = 'page-layout-no-masthead-margin';
}
if (!SiteOrigin_Settings_Page_Settings::get('footer_margin')) {
$classes[] = 'page-layout-no-footer-margin';
}
}
if (!is_active_sidebar('main-sidebar')) {
$classes[] = 'no-active-sidebar';
}
if (siteorigin_setting('navigation_sticky')) {
$classes[] = 'sticky-menu';
}
if (wp_is_mobile()) {
$classes[] = 'is_mobile';
}
return $classes;
}
示例4: parallax_home_genesis_meta
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function parallax_home_genesis_meta()
{
if (is_active_sidebar('home-section-1') || is_active_sidebar('home-section-2') || is_active_sidebar('home-section-3') || is_active_sidebar('home-section-4') || is_active_sidebar('home-section-5')) {
//* Enqueue parallax script
add_action('wp_enqueue_scripts', 'parallax_enqueue_parallax_script');
function parallax_enqueue_parallax_script()
{
if (!wp_is_mobile()) {
wp_enqueue_script('parallax-script', get_bloginfo('stylesheet_directory') . '/js/parallax.js', array('jquery'), '1.0.0');
}
}
//* Add parallax-home body class
add_filter('body_class', 'parallax_body_class');
function parallax_body_class($classes)
{
$classes[] = 'parallax-home';
return $classes;
}
//* Force full width content layout
add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
//* Remove primary navigation
remove_action('genesis_before_content_sidebar_wrap', 'genesis_do_nav');
//* Remove breadcrumbs
remove_action('genesis_before_loop', 'genesis_do_breadcrumbs');
//* Remove the default Genesis loop
remove_action('genesis_loop', 'genesis_do_loop');
//* Add homepage widgets
add_action('genesis_loop', 'parallax_homepage_widgets');
}
}
示例5: ultra_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function ultra_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
// Adds a class of content-none if there are no posts.
if (!have_posts()) {
$classes[] = 'content-none';
}
// Add widget-dependent classes.
if (!is_active_sidebar('sidebar-1')) {
$classes[] = 'one-column';
}
// Add a class if the sidebar is use.
if (is_active_sidebar('sidebar-1')) {
$classes[] = 'sidebar';
}
// Add a class if viewed on mobile.
if (wp_is_mobile()) {
$classes[] = 'mobile-device';
}
if (siteorigin_setting('header_tagline')) {
$classes[] = 'tagline';
}
// Add a class if the page slider overlap is true.
if (get_post_meta(get_the_ID(), 'ultra_metaslider_slider_overlap', true) == true) {
$classes[] = 'overlap';
}
return $classes;
}
示例6: get_bootplate_widget_footer_cols
function get_bootplate_widget_footer_cols()
{
$got1 = is_active_sidebar('footer-1');
$got2 = is_active_sidebar('footer-2');
$got3 = is_active_sidebar('footer-3');
$got4 = is_active_sidebar('footer-4');
if ($got1 || $got2 || $got3 || $got4) {
$gotsome = true;
} else {
$gotsome = false;
}
if ($got1 && $got2 && $got3 && $got4) {
$gotall = true;
} else {
$gotall = false;
}
if ($gotall) {
$classes = 'col-sm-6 col-lg-3';
} elseif ($got1 && $got2 && !$got3 && !$got4 || !$got1 && !$got2 && $got3 && $got4) {
$classes = 'col-sm-6';
} elseif ($got1 && $got2 && $got3 && !$got4) {
$classes = 'col-sm-4';
} elseif ($got1 && $got2 && $got3 && $got4) {
$classes = 'col-sm-6 col-lg-3';
} else {
$classes = 'col-md-12';
}
if ($gotsome) {
return $classes;
} else {
return '';
}
}
示例7: genesis_footer_widget_areas
/**
* Echo the markup necessary to facilitate the footer widget areas.
*
* Check for a numerical parameter given when adding theme support - if none is found, then the function returns early.
*
* The child theme must style the widget areas.
*
* Applies the `genesis_footer_widget_areas` filter.
*
* @since 1.6.0
*
* @uses genesis_structural_wrap() Optionally adds wrap with footer-widgets context.
*
* @return null Return early if number of widget areas could not be determined, or nothing is added to the first widget area.
*/
function genesis_footer_widget_areas()
{
$footer_widgets = get_theme_support('genesis-footer-widgets');
if (!$footer_widgets || !isset($footer_widgets[0]) || !is_numeric($footer_widgets[0])) {
return;
}
$footer_widgets = (int) $footer_widgets[0];
//* Check to see if first widget area has widgets. If not, do nothing. No need to check all footer widget areas.
if (!is_active_sidebar('footer-1')) {
return;
}
$inside = '';
$output = '';
$counter = 1;
while ($counter <= $footer_widgets) {
//* Darn you, WordPress! Gotta output buffer.
ob_start();
dynamic_sidebar('footer-' . $counter);
$widgets = ob_get_clean();
if ($widgets) {
$inside .= sprintf('<div class="footer-widgets-%d widget-area">%s</div>', $counter, $widgets);
}
$counter++;
}
if ($inside) {
$output .= genesis_markup(array('html5' => '<div %s>' . genesis_sidebar_title('Footer'), 'xhtml' => '<div id="footer-widgets" class="footer-widgets">', 'context' => 'footer-widgets', 'echo' => false));
$output .= genesis_structural_wrap('footer-widgets', 'open', 0);
$output .= $inside;
$output .= genesis_structural_wrap('footer-widgets', 'close', 0);
$output .= '</div>';
}
echo apply_filters('genesis_footer_widget_areas', $output, $footer_widgets);
}
示例8: emphasize_bottomgroup
function emphasize_bottomgroup()
{
$count = 0;
if (is_active_sidebar('bottom1')) {
$count++;
}
if (is_active_sidebar('bottom2')) {
$count++;
}
if (is_active_sidebar('bottom3')) {
$count++;
}
if (is_active_sidebar('bottom4')) {
$count++;
}
$class = '';
switch ($count) {
case '1':
$class = 'col-md-12';
break;
case '2':
$class = 'col-md-6';
break;
case '3':
$class = 'col-md-4';
break;
case '4':
$class = 'col-md-3';
break;
}
if ($class) {
echo 'class="' . $class . '"';
}
}
示例9: custom_body_classes
function custom_body_classes($classes)
{
if (is_active_sidebar('sidebar-3')) {
$classes[] = 'footer-widgets';
}
return $classes;
}
示例10: __construct
public function __construct()
{
if (!is_admin()) {
return;
}
$menus = get_theme_mod('nav_menu_locations');
$this->theme = wp_get_theme();
$has_listings = new WP_Query(array('post_type' => 'job_listing', 'fields' => 'ids', 'posts_per_page' => 1));
$this->steps = array('install-plugins' => array('title' => __('Install Required & Recommended Plugins', 'listify'), 'completed' => class_exists('WP_Job_Manager') && class_exists('WooCommerce'), 'description' => '<p>
Before you can use Listify you must first install WP Job Manager and WooCommerce.
You can read about <a
href="http://listify.astoundify.com/article/260-why-does-this-theme-require-plugins">why this theme
requires plugins</a> in our documentation.
</p>
<p><strong>Note:</strong></strong>
<ul>
<li>When installing WP Job Manager and WooCommerce <strong>do not</strong> use the automatic setup and
install the recommend pages. This will be done automatically when you import the demo XML.</li>
<li>Only free plugins/add-ons can be installed automatically. You will need to install any premium
plugins/add-ons separately.</li>
<li>It is recommended you install and activate any additional plugins you plan on using before importing
any XML content.</li>
<li><strong>Once your plugins are installed</strong> and content is imported please review all plugin
settings pages to make sure everything has been properly set up.</li>
</ul>' . sprintf('<a href="%1$s/images/setup/setup-plugins.gif"><img
src="%1$s/images/setup/setup-plugins.gif" width="430" alt=""
/></a>', get_template_directory_uri()) . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('themes.php?page=tgmpa-install-plugins'), __('Install Plugins', 'listify')) . '</p>', 'documentation' => array('WP Job Manager' => 'http://listify.astoundify.com/article/228-wp-job-manager', 'WooCommerce' => 'http://listify.astoundify.com/article/229-woocommerce', 'Jetpack' => 'http://listify.astoundify.com/article/230-jetpack', 'Bulk Install' => 'http://listify.astoundify.com/article/320-bulk-install-required-and-recommended-plugins')), 'import-content' => array('title' => __('Import Demo Content', 'listify'), 'completed' => $has_listings->have_posts(), 'description' => '<p>' . __('Installing the demo content is not required to use this theme. It is simply meant to provide a way to get a feel for the theme without having to manually set up all of your own content. <strong>If you choose not to import the demo content you need to make sure you manually create all necessary page templates for your website.</strong>', 'listify') . '</p>' . '<p>' . __('The Listify theme package includes multiple demo content .XML files. This is what you will
upload to the WordPress importer. Depending on the plugins you have activated or the intended use of your
website you may not need to upload all .XML files.', 'listify') . '</p>' . sprintf('<a href="%1$s/images/setup/setup-content.gif"><img src="%1$s/images/setup/setup-content.gif" width="430" alt=""
/></a>', get_template_directory_uri()) . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('import.php'), __('Begin Importing Content', 'listify')) . '</p>', 'documentation' => array('Install Demo Content' => 'http://listify.astoundify.com/article/236-installing-demo-content', 'Manually Add a Listing' => 'http://listify.astoundify.com/article/245-adding-a-listing', 'Importing Content (Codex)' => 'http://codex.wordpress.org/Importing_Content', 'WordPress Importer' => 'https://wordpress.org/plugins/wordpress-importer/')), 'import-widgets' => array('title' => __('Import Widgets', 'listify'), 'completed' => is_active_sidebar('widget-area-home'), 'description' => '<p>' . __('Importing the demo widgets is not required to use this theme. It simply allows you to quickly match the same settings found on our theme demo. If you do not import the widgets you can manually manage your widgets just like a standard WordPress widget area.', 'listify') . '</p>' . sprintf('<a href="%1$s/images/setup/setup-widgets.gif"><img src="%1$s/images/setup/setup-widgets.gif" width="430" alt="" /></a>', get_template_directory_uri()) . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('tools.php?page=widget-importer-exporter'), __('Begin Importing Widgets', 'listify')) . '</p>', 'documentation' => array('Widget Areas' => 'http://listify.astoundify.com/category/352-widget-areas', 'Widgets' => 'http://listify.astoundify.com/category/199-widgets')), 'setup-menus' => array('title' => __('Setup Menus', 'listify'), 'description' => '<p>' . __('Make sure you create and assign your menus to the menu locations found in the theme. This is required to use the custom mega menu dropdown, account item, and more.', 'listify') . '</p>' . sprintf('<a href="%1$s/images/setup/setup-menus.gif"><img src="%1$s/images/setup/setup-menus.gif" width="430" alt="" /></a>', get_template_directory_uri()) . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('nav-menus.php'), __('Manage Menus', 'listify')) . '</p>', 'completed' => isset($menus['primary']), 'documentation' => array('Primary Menu' => 'http://listify.astoundify.com/article/250-manage-the-primary-menu', 'Secondary Menu' => 'http://listify.astoundify.com/article/253-manage-the-secondary-menu', 'Tertiary Menu' => 'http://listify.astoundify.com/article/254-enable-the-tertiary-navigation', 'Add a Dropdown' => 'http://listify.astoundify.com/article/252-add-a-dropdown-menu', 'Add an Avatar' => 'http://listify.astoundify.com/article/251-add-the-avatar-menu-item', 'Adding Icons' => 'http://listify.astoundify.com/article/257-adding-icons-to-menu-items', 'Create a Popup' => 'http://listify.astoundify.com/article/255-creating-a-popup-menu-item', 'Show/Hide Items' => 'http://listify.astoundify.com/article/256-show-different-menus-for-logged-in-or-logged-out')), 'setup-homepage' => array('title' => __('Setup Static Homepage', 'listify'), 'description' => '<p>' . __('In order to display custom widgets on your homepage you must first assign your static page in the WordPress settings. You can also set which page will display your blog posts.', 'listify') . '</p>' . sprintf('<a href="%1$s/images/setup/setup-reading.gif"><img src="%1$s/images/setup/setup-reading.gif" width="430" alt="" /></a>', get_template_directory_uri()) . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('options-reading.php'), __('Reading Settings', 'listify')) . '</p>', 'completed' => get_option('page_on_front'), 'documentation' => array('Create Your Homepage' => 'http://listify.astoundify.com/article/261-creating-your-homepage', 'Reading Settings (codex)' => 'http://codex.wordpress.org/Settings_Reading_Screen')), 'setup-widgets' => array('title' => __('Setup Widgets', 'listify'), 'completed' => is_active_sidebar('widget-area-home'), 'description' => '<p>' . __('Manage your widgets to control what displays on your homepage, listing pages, standard pages, and more.', 'listify') . '</p>' . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('widgets.php'), __('Manage Widgets', 'listify')) . '</p>', 'documentation' => array('Widget Areas' => 'http://listify.astoundify.com/category/352-widget-areas', 'Widgets' => 'http://listify.astoundify.com/category/199-widgets')), 'customize-theme' => array('title' => __('Customize', 'listify'), 'description' => '<p>' . __('Manage the appearance and behavior of various theme components with the live customizer.', 'listify') . '</p>' . '<p>' . sprintf('<a href="%s" class="button button-primary button-large">%s</a>', admin_url('customize.php'), __('Customize', 'listify')) . '</p>', 'completed' => get_option('theme_mods_listify'), 'documentation' => array('Appearance' => 'http://listify.astoundify.com/category/334-appearance', 'Booking Services' => 'http://listify.astoundify.com/category/455-booking-service-integration', 'Child Themes' => 'http://listify.astoundify.com/category/209-child-themes', 'Translations' => 'http://listify.astoundify.com/category/210-translations')), 'support-us' => array('title' => __('Get Involved', 'listify'), 'description' => __('Help improve Listify by submitting a rating and helping to translate the theme to as many languages as possible!', 'listify'), 'completed' => true, 'documentation' => array('Leave a Positive Review' => 'http://bit.ly/rate-listify', 'Contribute Your Translation' => 'http://bit.ly/translate-listify')));
add_action('admin_menu', array($this, 'add_page'), 100);
add_action('admin_menu', array($this, 'add_meta_boxes'));
add_action('admin_head', array($this, 'admin_css'));
}
示例11: magazine_home_loop_helper
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function magazine_home_loop_helper()
{
if (is_active_sidebar('home-top') || is_active_sidebar('home-left') || is_active_sidebar('home-right') || is_active_sidebar('home-bottom')) {
if (is_active_sidebar('home-top')) {
echo '<div class="home-top">';
dynamic_sidebar('home-top');
echo '</div><!-- end .home-top -->';
}
if (is_active_sidebar('home-left') || is_active_sidebar('home-right')) {
echo '<div class="home-middle">';
if (is_active_sidebar('home-left')) {
echo '<div class="home-left">';
dynamic_sidebar('home-left');
echo '</div><!-- end .home-left -->';
}
if (is_active_sidebar('home-right')) {
echo '<div class="home-right">';
dynamic_sidebar('home-right');
echo '</div><!-- end .home-right -->';
}
echo '</div><!-- end .home-middle -->';
}
if (is_active_sidebar('home-bottom')) {
echo '<div class="home-bottom">';
dynamic_sidebar('home-bottom');
echo '</div><!-- end .home-bottom -->';
}
} else {
genesis_standard_loop();
}
}
示例12: _lbbee78bef56_content
function _lbbee78bef56_content($_l, $_args)
{
extract($_args);
?>
<section class="section content-section blog-section not-found-section">
<div id="container" class="subpage blog 404 wrapper <?php
if (is_active_sidebar("blog-sidebar")) {
} else {
?>
onecolumn<?php
}
?>
">
<div id="content" class="entry-content clearfix" role="main">
<div class="content-wrapper">
<?php
NCoreMacros::includeTemplate("snippets/nothing-found.php", $template->getParams(), $_l->templates['pemu234rbc'])->render();
?>
</div> <!-- /.content-wrapper -->
</div> <!-- /#content -->
</div> <!-- /#container -->
</section>
<?php
}
示例13: dln_template_blank_page
function dln_template_blank_page()
{
if (is_page_template('page-templates/blank-page.php') || is_attachment() || !is_active_sidebar('sidebar-1')) {
global $content_width;
$content_width = 960;
}
}
示例14: jumbotron_content
function jumbotron_content()
{
global $ss_settings, $ss_framework;
$hero = false;
$site_style = $ss_settings['site_style'];
$visibility = $ss_settings['jumbotron_visibility'];
$nocontainer = $ss_settings['jumbotron_nocontainer'];
if (($visibility == 1 && is_front_page() || $visibility != 1) && is_active_sidebar('jumbotron')) {
$hero = true;
}
if ($hero) {
echo $ss_framework->clearfix();
echo '<div class="before-main-wrapper">';
if ($site_style == 'boxed' && $nocontainer != 1) {
echo '<div class="' . Shoestrap_Layout::container_class() . '">';
}
echo '<div class="jumbotron">';
if ($nocontainer != 1 && $site_style == 'wide' || $site_style == 'boxed') {
echo '<div class="' . Shoestrap_Layout::container_class() . '">';
}
dynamic_sidebar('Jumbotron');
if ($nocontainer != 1 && $site_style == 'wide' || $site_style == 'boxed') {
echo '</div>';
}
echo '</div>';
if ($site_style == 'boxed' && $nocontainer != 1) {
echo '</div>';
}
echo '</div>';
}
}
示例15: oriental_infinite_scroll_has_footer_widgets
function oriental_infinite_scroll_has_footer_widgets()
{
if (function_exists('jetpack_is_mobile') && jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
return true;
}
return false;
}