コード例 #1
0
 /**
  * Returns the current layout type and defines WPV_LAYOUT accordingly
  *
  * @return string current page layout
  */
 public static function get_layout()
 {
     global $post;
     if (!defined('WPV_LAYOUT_TYPE')) {
         if (wpv_has_woocommerce()) {
             $id_override = is_single() ? $post->ID : (woocommerce_get_page_id('shop') ? woocommerce_get_page_id('shop') : null);
             if (is_shop() || is_product_category() || is_product_tag()) {
                 define('WPV_LAYOUT_TYPE', wpv_post_meta_default('layout-type', 'default-body-layout', $id_override));
                 return WPV_LAYOUT_TYPE;
             }
         }
         if (is_404() || is_page_template('page-blank.php')) {
             define('WPV_LAYOUT_TYPE', 'full');
             define('WPV_LAYOUT', 'no-sidebars');
             return WPV_LAYOUT_TYPE;
         }
         $layout_type = '';
         if (is_singular(WpvFramework::$complex_layout) || wpv_has_woocommerce() && is_woocommerce()) {
             $layout_type = wpv_post_meta_default('layout-type', 'default-body-layout');
         } else {
             $layout_type = wpv_get_option('default-body-layout');
         }
         if (empty($layout_type)) {
             $layout_type = 'full';
         }
         define('WPV_LAYOUT_TYPE', $layout_type);
         switch ($layout_type) {
             case 'left-only':
                 define('WPV_LAYOUT', 'left-sidebar');
                 break;
             case 'right-only':
                 define('WPV_LAYOUT', 'right-sidebar');
                 break;
             case 'left-right':
                 define('WPV_LAYOUT', 'two-sidebars');
                 break;
             case 'full':
                 define('WPV_LAYOUT', 'no-sidebars');
                 break;
         }
         return $layout_type;
     }
     return WPV_LAYOUT_TYPE;
 }
コード例 #2
0
function theme_body_classes($body_class)
{
    global $wpv_has_header_sidebars, $post, $wpv_is_shortcode_preview;
    $is_blank_page = is_page_template('page-blank.php');
    $has_header_slider = WpvTemplates::has_header_slider();
    $wpv_has_header_sidebars = wpv_post_meta_default('show_header_sidebars', 'has-header-sidebars');
    $has_page_header = (WpvTemplates::has_page_header() || WpvTemplates::has_post_siblings_buttons()) && !is_404();
    $body_class[] = $is_blank_page ? 'full' : wpv_get_option('site-layout-type');
    $body_class[] = 'pagination-' . wpv_get_option('pagination-type');
    $body_class[] = is_singular(WpvFramework::$complex_layout) ? 'sticky-header-type-' . wpv_post_meta(null, 'sticky-header-type', true) : '';
    $body_class[] = 'wpv-not-scrolled';
    $body_class_conditions = array('no-page-header' => !$has_page_header, 'has-page-header' => $has_page_header, 'cbox-share-twitter' => wpv_get_optionb('share-lightbox-twitter'), 'cbox-share-facebook' => wpv_get_optionb('share-lightbox-facebook'), 'cbox-share-googleplus' => wpv_get_optionb('share-lightbox-googleplus'), 'cbox-share-pinterest' => wpv_get_optionb('share-lightbox-pinterest'), 'fixed-header' => wpv_get_optionb('fixed-header'), 'has-header-slider' => $has_header_slider, 'has-header-sidebars' => $wpv_has_header_sidebars, 'no-header-slider' => !$has_header_slider, 'no-header-sidebars' => !$wpv_has_header_sidebars, 'no-footer-sidebars' => !wpv_get_optionb('has-footer-sidebars'), 'responsive-layout' => WPV_RESPONSIVE, 'fixed-layout' => !WPV_RESPONSIVE, 'has-breadcrumbs' => wpv_get_optionb('enable-breadcrumbs'), 'no-breadcrumbs' => !wpv_get_optionb('enable-breadcrumbs'), 'no-slider-button-thumbnails' => !wpv_get_optionb('header-slider-button-thumbnails'), 'sticky-header' => wpv_get_optionb('sticky-header'), 'no-page-bottom-padding' => wpv_post_meta(null, 'use-page-bottom-padding', true) == 'false', 'vamtam-shortcode-tooltip-preview' => $wpv_is_shortcode_preview && strpos($GLOBALS['wpv_current_shortcode'], '[tooltip') !== false);
    foreach ($body_class_conditions as $class => $cond) {
        if ($cond) {
            $body_class[] = $class;
        }
    }
    if (is_archive() || is_search() || get_query_var('format_filter')) {
        define('WPV_ARCHIVE_TEMPLATE', true);
    }
    return $body_class;
}