本文整理汇总了PHP中get_body_class函数的典型用法代码示例。如果您正苦于以下问题:PHP get_body_class函数的具体用法?PHP get_body_class怎么用?PHP get_body_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_body_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:12,代码来源:functions.php
示例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;
}
开发者ID:enesgur,项目名称:incir-wp,代码行数:26,代码来源:functions.php
示例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;
}
开发者ID:gcofficial,项目名称:basetheme,代码行数:13,代码来源:main.php
示例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;
}
开发者ID:drupalninja,项目名称:schome_org,代码行数:9,代码来源:plugin-assets.php
示例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);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:13,代码来源:getBodyClass.php
示例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);
}
开发者ID:w392807287,项目名称:FirstRepository,代码行数:13,代码来源:ajax-load.php
示例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);
}
开发者ID:rastabrane,项目名称:gantry5,代码行数:10,代码来源:Page.php
示例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");
}
开发者ID:riseofthetigers,项目名称:wxp-starter-theme,代码行数:58,代码来源:DomRouter.php
示例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;
}
开发者ID:mastinoz,项目名称:Momtaz-Framework,代码行数:17,代码来源:markup.php
示例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);
}
开发者ID:ericssonm,项目名称:JusCuzCustoms,代码行数:12,代码来源:Page.php
示例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 "";
}
开发者ID:gabzon,项目名称:experiensa,代码行数:13,代码来源:header.php
示例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);
}
开发者ID:atrus1701,项目名称:jetpack,代码行数:13,代码来源:test_class.infinite-scroll.php
示例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
}
开发者ID:loevendahl,项目名称:flexbil,代码行数:51,代码来源:frame_html.php
示例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]);
}
开发者ID:riesurya,项目名称:DeVioPlayground,代码行数:16,代码来源:class.DeVioPlaygroundPro_Layout.php
示例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;
}
开发者ID:acip,项目名称:enhanced-category-pages,代码行数:16,代码来源:WP_Integration.php
示例16: test_with_utf8_term_slugs
/**
* @ticket 30883
*/
public function test_with_utf8_term_slugs()
{
register_taxonomy('wptests_tax', 'post');
$term_id1 = $this->factory->term->create(array('taxonomy' => 'wptests_tax', 'name' => 'Первая метка'));
$term_id2 = $this->factory->term->create(array('taxonomy' => 'wptests_tax', 'name' => 'Вторая метка'));
$term_id3 = $this->factory->term->create(array('taxonomy' => 'wptests_tax', 'name' => '25кадр'));
wp_set_post_terms($this->post_id, array($term_id1, $term_id2, $term_id3), 'wptests_tax');
$term1 = get_term($term_id1, 'wptests_tax');
$term2 = get_term($term_id2, 'wptests_tax');
$term3 = get_term($term_id3, 'wptests_tax');
$this->go_to(home_url("?wptests_tax={$term1->slug}"));
$this->assertContains("term-{$term_id1}", get_body_class());
$this->go_to(home_url("?wptests_tax={$term2->slug}"));
$this->assertContains("term-{$term_id2}", get_body_class());
$this->go_to(home_url("?wptests_tax={$term3->slug}"));
$this->assertContains("term-{$term_id3}", get_body_class());
}
开发者ID:Benrajalu,项目名称:philRaj,代码行数:20,代码来源:getBodyClass.php
示例17: cgp_genesis_header
function cgp_genesis_header()
{
do_action('genesis_doctype');
do_action('genesis_title');
do_action('genesis_meta');
wp_head();
//* we need this for plugins
?>
</head>
<?php
genesis_markup(array('html5' => '<body %s>', 'xhtml' => sprintf('<body class="%s">', implode(' ', get_body_class())), 'context' => 'body'));
do_action('genesis_before');
genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div id="wrap">', 'context' => 'site-container'));
do_action('genesis_before_header');
do_action('genesis_header');
do_action('genesis_after_header');
genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div id="inner">', 'context' => 'content-wrapper'));
genesis_structural_wrap('content-wrapper');
}
开发者ID:hsagulo,项目名称:mx,代码行数:19,代码来源:front-page.php
示例18: wpsc_get_add_to_cart_form_args
/**
* Return the array containing arguments to generate the "Add to cart" form.
*
* The returned array can then be used with {@link wpsc_get_form_output()} to
* generate the HTML output.
*
* @since 0.1
* @uses apply_filters() Applies 'wpsc_add_to_cart_button_icon' filter. Set the value to an empty value to disable the icon
* @uses apply_filters() Applies 'wpsc_add_to_cart_button_title' filter. The return value must be escaped already.
* @uses apply_filters() Applies 'wpsc_get_add_to_cart_form_args' filter. Use this filter to add more fields
* @uses wpsc_get_product_id() Get current product ID in the loop
* @uses wpsc_get_cart_url() Get cart URL for the form action
* @uses WPSC_Product::get_instance() get the WPSC_Product object to fetch variation sets and terms
*
* @param int $id Optional. Product ID. Defaults to the current product in the loop.
* @return array Form argument array
*/
function wpsc_get_add_to_cart_form_args($id = null)
{
if (!$id) {
$id = wpsc_get_product_id();
}
$product = WPSC_Product::get_instance($id);
$has_variations = $product->has_variations;
$classes = get_body_class();
$select_options = $has_variations != false && in_array('wpsc-grid', $classes);
$args = array('class' => 'wpsc-form wpsc-form-horizontal wpsc-add-to-cart-form', 'action' => $select_options ? get_permalink($id) : wpsc_get_cart_url("add/{$id}"), 'id' => "wpsc-add-to-cart-form-{$id}", 'fields' => array(array('name' => 'quantity', 'type' => 'textfield', 'title' => __('Quantity', 'wp-e-commerce'), 'value' => 1)));
// generate the variation dropdown menus
foreach ($product->variation_sets as $variation_set_id => $title) {
$variation_terms = $product->variation_terms[$variation_set_id];
$args['fields'][] = array('name' => "wpsc_product_variations[{$variation_set_id}]", 'type' => 'select', 'options' => $variation_terms, 'title' => $title);
}
// form action section contains the button and hidden values
$args['form_actions'] = array(array('type' => 'button', 'primary' => true, 'button_class' => $select_options ? 'wpsc-select-options' : 'wpsc-add-to-cart', 'icon' => apply_filters('wpsc_add_to_cart_button_icon', array($select_options ? '' : 'shopping-cart', 'white')), 'title' => apply_filters('wpsc_add_to_cart_button_title', $select_options ? __('Select Options', 'wp-e-commerce') : __('Add to Cart', 'wp-e-commerce'), $select_options)), array('type' => 'hidden', 'name' => '_wp_http_referer', 'value' => home_url($_SERVER['REQUEST_URI'])), array('type' => 'hidden', 'name' => '_wp_nonce', 'value' => wp_create_nonce("wpsc-add-to-cart-{$id}")));
$args = apply_filters('wpsc_get_add_to_cart_form_args', $args);
return $args;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:37,代码来源:form.php
示例19: nm_is_woocommerce_page
function nm_is_woocommerce_page()
{
// Alt. methhod:
/*if ( is_woocommerce() ) {
return true;
}
$page_id = get_the_ID();
$woocommerce_keys = array (
'woocommerce_shop_page_id',
'woocommerce_terms_page_id',
'woocommerce_cart_page_id',
'woocommerce_checkout_page_id',
'woocommerce_pay_page_id',
'woocommerce_thanks_page_id',
'woocommerce_myaccount_page_id',
'woocommerce_edit_address_page_id',
'woocommerce_view_order_page_id',
'woocommerce_change_password_page_id',
'woocommerce_logout_page_id',
'woocommerce_lost_password_page_id'
) ;
foreach( $woocommerce_keys as $woocommerce_page_id ) {
if ( $page_id == get_option( $woocommerce_page_id, 0 ) ) {
return true;
}
}*/
// Get the current body class
$body_classes = get_body_class();
foreach ($body_classes as $body_class) {
// Check if the class contains the word "woocommrce"
if (strpos($body_class, 'woocommerce') !== false) {
return true;
}
}
return false;
}
开发者ID:kevinotsuka,项目名称:coffeecircle,代码行数:38,代码来源:helpers.php
示例20: do_action
<?php
/**
* qode_ajax_meta hook
*
* @hooked qode_ajax_meta - 10
*/
do_action('qode_ajax_meta');
?>
<span id="qode_page_id"><?php
echo $wp_query->get_queried_object_id();
?>
</span>
<div class="body_classes"><?php
echo implode(',', get_body_class());
?>
</div>
</div>
<?php
}
?>
<div class="content_inner <?php
echo $animation;
?>
">
<?php
if ($qode_options_proya['page_transitions'] == "1" || $qode_options_proya['page_transitions'] == "2" || $qode_options_proya['page_transitions'] == "3" || $qode_options_proya['page_transitions'] == "4" || $animation == "updown" || $animation == "fade" || $animation == "updown_fade" || $animation == "leftright") {
?>
<?php
do_action('qode_visual_composer_custom_shortcodce_css');
开发者ID:bunnywong,项目名称:freshlinker,代码行数:30,代码来源:header.php
注:本文中的get_body_class函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论