本文整理汇总了PHP中get_body_class函数的典型用法代码示例。如果您正苦于以下问题:PHP get_body_class函数的具体用法?PHP get_body_class怎么用?PHP get_body_class使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_body_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: huesos_content_width
/**
* Adjust the content width.
*
* @since 1.0.0
*/
function huesos_content_width()
{
global $content_width;
if (in_array('layout-full', get_body_class())) {
$content_width = 910;
}
}
示例2: incir_body_class
function incir_body_class()
{
$classes = get_body_class();
if (is_front_page()) {
$template = basename(get_page_template());
switch ($template) {
case 'page-front-1.php':
$classes[] = 'home-1';
break;
case 'page-front-2.php':
$classes[] = 'home-2';
break;
case 'page-front-3.php':
$classes[] = 'home-3';
break;
case 'page.php':
$classes[] = 'home-1';
break;
case 'index.php':
$classes[] = 'home-1';
break;
}
}
$classes = implode(' ', $classes);
return $classes;
}
示例3: header_data
/**
* Header data for header section
*
* @return array
*/
public static function header_data()
{
$header_image = get_header_image();
$page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width();
$header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false)));
$header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name'));
return $header;
}
示例4: cherry_under_construction_page_content
function cherry_under_construction_page_content()
{
echo '<body class="' . join(' ', get_body_class()) . '"><div id="motopress-main" class="main-holder"><!--Begin #motopress-main-->';
$files = '/plugin-under-construction-content.php';
$template_dir = file_exists(CURRENT_THEME_DIR . $files) ? CURRENT_THEME_DIR . $files : CHERRY_PLUGIN_DIR . 'includes' . $files;
include_once $template_dir;
echo '</body></div><html>';
exit;
}
示例5: test_singular_body_classes
/**
* @ticket 35164
* @ticket 36510
*/
public function test_singular_body_classes()
{
$post_id = self::factory()->post->create();
$this->go_to(get_permalink($post_id));
$class = get_body_class();
$this->assertContains("single-post", $class);
$this->assertContains("postid-{$post_id}", $class);
$this->assertContains("single-format-standard", $class);
}
示例6: Bing_ajax_load_page_data
/**
*处理 AJAX 加载页面数据
*http://www.bgbk.org
*/
function Bing_ajax_load_page_data($code)
{
$data = array('code' => $code, 'title' => wp_title('|', false, 'right'), 'body_class' => join(' ', get_body_class($class)), 'refresh_sidebar' => false, 'mobile_menu_current' => Bing_mobile_menu_current(), 'mobile_title' => Bing_mobile_title(), 'mobile_return_show' => is_singular() && get_post_type() != 'page', 'last_change' => get_option(THEME_SLUG . '_last_change'));
if ($sidebar_code = apply_filters('ajax_load_page_sidebar_code', null)) {
$data['refresh_sidebar'] = true;
$data['sidebar_code'] = $sidebar_code;
}
return wp_json_encode($data);
}
示例7: bodyAttributes
public function bodyAttributes($attributes = [])
{
// TODO: we might need something like
// class="{{body_class}}" data-template="{{ twigTemplate|default('base.twig') }}"
$wp_body_class = get_body_class();
if (is_array($wp_body_class) && !empty($wp_body_class)) {
$attributes['class'] = array_merge_recursive($attributes['class'], $wp_body_class);
}
return $this->getAttributes((array) $this->config->get('page.body'), $attributes);
}
示例8: route
/**
* fires actions bound to body class routes
*/
function route()
{
do_action("WXP.DomRoute.before");
$body_class = get_body_class();
//add 'common' to the body class array
array_unshift($body_class, 'common');
//apply filters to body classes
$body_class = apply_filters("WXP.DomRoute.body_classes", $body_class);
//return false if no routes set
if (empty($this->routes)) {
return false;
}
foreach ($this->routes as $route_hook => $actions) {
//if $action has the class key that means an action
//was bound to multiple classes and wont be fired unless
//all of those classes are present
if (isset($actions["class"])) {
$found = true;
foreach ($actions["class"] as $cls) {
$found = in_array($cls, $body_class);
if (!$found) {
break;
}
}
//if all classes are not found skip to next route
if (!$found) {
continue;
}
//else if all classes are found set $actions with the value
$actions = (array) $actions['action'];
} else {
if (!in_array($route_hook, $body_class)) {
continue;
}
}
//fire actions if not in $called_callbacks array
foreach ($actions as $action) {
if (is_string($action) && isset($this->called_callbacks[$action])) {
//if value is set to true, that means the
//callback has been called already
//skip to next action
if ($this->called_callbacks[$action] === true) {
continue;
}
//else the callback has not been fired yet
//set value to true to prevent it from being fired
//again in another route
$this->called_callbacks[$action] = true;
}
//finally fire the callback/action
WXP::call_target($action, array(View::getInstance()), true);
}
}
do_action("WXP.DomRoute.after");
}
示例9: momtaz_atts_body
/**
* Add attributes for the body element.
*
* @return array
* @since 1.3
*/
function momtaz_atts_body($atts)
{
if (!isset($atts['class'])) {
$atts['class'] = get_body_class();
} else {
$atts['class'] = get_body_class($atts['class']);
}
$atts['itemscope'] = 'itemscope';
$atts['itemtype'] = 'http://schema.org/WebPage';
return $atts;
}
示例10: bodyAttributes
public function bodyAttributes($attributes = [])
{
// TODO: we might need something like
// class="{{body_class}}" data-template="{{ twigTemplate|default('base.twig') }}"
$body_classes = apply_filters('gantry5_body_classes', ['site', 'outline-' . Gantry::instance()['configuration']]);
is_rtl() ? $body_classes[] = 'dir-rtl' : ($body_classes[] = 'dir-ltr');
$wp_body_class = get_body_class($body_classes);
if (is_array($wp_body_class) && !empty($wp_body_class)) {
$attributes['class'] = array_merge_recursive($attributes['class'], $wp_body_class);
}
return $this->getAttributes((array) $this->config->get('page.body.attribs'), $attributes);
}
示例11: scroll_menu_class
public static function scroll_menu_class()
{
$classes = get_body_class();
$design_options = get_option('experiensa_design_settings');
$display_slider = $design_options['setting_landing_slider'];
if (in_array('home', $classes) && $display_slider == 'TRUE') {
return 'white-font';
}
if (in_array('single-voyage', $classes)) {
return 'white-font';
}
return "";
}
示例12: test_body_class_type_click
public function test_body_class_type_click()
{
The_Neverending_Home_Page::$settings['type'] = 'click';
add_filter('body_class', array($this->infinite_scroll, 'body_class'));
$classes = get_body_class();
$this->assertContains('infinite-scroll', $classes);
$this->assertNotContains('neverending', $classes);
// Disable Infinite Scroll.
update_option(The_Neverending_Home_Page::$option_name_enabled, '');
$classes = get_body_class();
$this->assertContains('infinite-scroll', $classes);
$this->assertNotContains('neverending', $classes);
}
示例13: bizz_html_header
function bizz_html_header()
{
global $post;
echo apply_filters('bizz_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">') . "\n";
#filter
?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php
language_attributes();
?>
>
<?php
// HEAD
echo "<head" . apply_filters('bizz_head_profile', ' profile="http://gmpg.org/xfn/11"') . ">\n";
#filter
echo '<meta http-equiv="Content-Type" content="' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') . '" />' . "\n";
#wp
if (!is_admin()) {
if (is_singular() && comments_open() && get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
}
#wp
do_action('bizz_head_before');
#hook
do_action('bizz_head_title');
#hook
do_action('bizz_head_meta');
#hook
do_action('bizz_head_stylesheets');
#hook
do_action('bizz_head_links');
#hook
do_action('bizz_head_scripts');
#hook
wp_head();
#wp #hook
do_action('bizz_head_after');
#hook
echo '<link rel="pingback" href="' . get_bloginfo('pingback_url') . '" />' . "\n";
#wp
echo "</head>\n";
#END <head> tag
// BODY
echo "<body " . apply_filters('bizz_body_class', 'class="' . implode(' ', get_body_class()) . '"') . ">\n";
#filter
do_action('bizz_body_after');
#hook
do_action('bizz_head_grid');
#hook
}
示例14: devio_bodyclass
function devio_bodyclass()
{
switch (true) {
case is_front_page():
case is_home():
$level[0] = 'home';
break;
case is_singular():
$level[0] = 'singular';
break;
default:
$level = get_body_class();
break;
}
return array($level[0]);
}
示例15: category_description_filter
public function category_description_filter($description, $categoryId = null)
{
$classes = get_body_class();
if (!in_array('date', $classes) && !in_array('post-type-archive', $classes)) {
$categoryId;
//play nice with All_in_One_SEO_Pack as we cannot use ob_start because of it
if ($this->_goodNeighbour->isCallFrom_All_in_One_SEO_Pack()) {
return $description;
}
ob_start();
include pathinfo($this->_plugin_file_path, PATHINFO_DIRNAME) . "/views/ecp_category_description.php";
$description = ob_get_clean();
return $description;
}
return false;
}