Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * Front-end styles
  */
 public function styles()
 {
     if (is_admin() || WpvTemplates::is_login()) {
         return;
     }
     $theme_version = WpvFramework::get_version();
     $external_fonts = maybe_unserialize(wpv_get_option('external-fonts'));
     if (is_array($external_fonts) && !empty($external_fonts)) {
         foreach ($external_fonts as $name => $url) {
             wp_enqueue_style('wpv-' . $name, $url, array(), $theme_version);
         }
     }
     wp_enqueue_style('front-magnific-popup', wpv_prepare_url(WPV_THEME_CSS . 'magnific.css'));
     $cache_timestamp = wpv_get_option('css-cache-timestamp');
     $generated_deps = array('front-magnific-popup');
     if (wpv_has_woocommerce()) {
         $generated_deps[] = 'woocommerce-layout';
         $generated_deps[] = 'woocommerce-smallscreen';
         $generated_deps[] = 'woocommerce-general';
     }
     if (class_exists('Tribe__Events__Main') && (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue())) {
         $generated_deps[] = 'tribe-events-calendar-style';
         $generated_deps[] = 'tribe-events-full-calendar-style';
     }
     $suffix = is_multisite() ? $GLOBALS['blog_id'] : '';
     $css_file = 'all' . $suffix . '.css';
     $css_path = WPV_CACHE_URI . $css_file;
     if (!file_exists(WPV_CACHE_DIR . $css_file)) {
         $css_path = WPV_SAMPLES_URI . 'all-default.css';
     }
     wp_enqueue_style('front-all', wpv_prepare_url($css_path), $generated_deps, $cache_timestamp);
     global $wpv_is_shortcode_preview;
     if ($wpv_is_shortcode_preview) {
         wp_enqueue_style('vamtam-shortcode-preview', WPV_ADMIN_ASSETS_URI . 'css/shortcode-preview.css');
     }
     $custom_icons = get_option('vamtam-custom-icons-map');
     if ($custom_icons) {
         $icons_path = trailingslashit(WP_CONTENT_URL) . 'vamtam/custom-icon-font/';
         $custom_icons_css = "\n\t\t\t\t@font-face {\n\t\t\t\t\tfont-family: 'vamtam-custom-icons';\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot);\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot?#iefix) format('embedded-opentype'),\n\t\t\t\t\t\turl({$icons_path}custom-icons.ttf) format('truetype');\n\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\tfont-style: normal;\n\t\t\t\t}\n\t\t\t";
         wp_add_inline_style('front-all', $custom_icons_css);
     }
 }
<?php

/**
 * WooCommerce-related functions and filters
 *
 * @package wpv
 */
/**
 * Alias for function_exists('is_woocommerce')
 * @return bool whether WooCommerce is active
 */
function wpv_has_woocommerce()
{
    return function_exists('is_woocommerce');
}
if (wpv_has_woocommerce()) {
    // we have woocommerce
    add_theme_support('woocommerce');
    // replace the default pagination with ours
    function woocommerce_pagination()
    {
        WpvTemplates::pagination_list();
    }
    // remove the WooCommerce breadcrumbs
    // we're still using their breadcrumbs, but a little higher in the HTML
    remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    // remove the WooCommerve sidebars
    remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
    /**
     * Redefine woocommerce_output_related_products()
     */
Ejemplo n.º 4
0
function wpv_get_the_ID()
{
    global $post;
    return wpv_has_woocommerce() && is_woocommerce() && !is_singular(array('page', 'product')) ? woocommerce_get_page_id('shop') : (isset($post) ? $post->ID : null);
}
Ejemplo n.º 5
0
<?php

/**
 * Site sub-header. Includes a slider, page title, etc.
 *
 * @package  wpv
 */
global $wpv_title;
if (!is_404()) {
    if (wpv_has_woocommerce() && is_woocommerce() && !is_single()) {
        if (is_product_category()) {
            $wpv_title = single_cat_title('', false);
        } elseif (is_product_tag()) {
            $wpv_title = single_tag_title('', false);
        } else {
            $wpv_title = woocommerce_get_page_id('shop') ? get_the_title(woocommerce_get_page_id('shop')) : '';
        }
    }
}
$page_header_bg = WpvTemplates::page_header_background();
$global_page_header_bg = wpv_get_option('page-title-background-image') . wpv_get_option('page-title-background-color');
if (!WpvTemplates::has_breadcrumbs() && !WpvTemplates::has_page_header() && !WpvTemplates::has_post_siblings_buttons() || is_404() && (!function_exists('tribe_is_event_query') || !tribe_is_event_query())) {
    return;
}
if (is_page_template('page-blank.php')) {
    return;
}
?>
<div id="sub-header" class="layout-<?php 
echo WpvTemplates::get_layout();
?>
Ejemplo n.º 6
0
 /**
  * Output the correct sidebar
  *
  * @uses dynamic_sidebar()
  *
  * @param  string $place one of $this->placements
  * @return bool          result of dynamic_sidebar()
  */
 public function get_sidebar($place = 'left')
 {
     global $post;
     if (is_front_page() || is_home() || is_page()) {
         $sidebar = $this->sidebars['page'];
     }
     if (is_singular('post')) {
         $sidebar = $this->sidebars['blog'];
     } elseif (is_singular('portfolio')) {
         $sidebar = $this->sidebars['portfolio'];
     }
     if (is_search() || is_archive()) {
         $sidebar = $this->sidebars['blog'];
     }
     if (wpv_has_woocommerce() && is_woocommerce()) {
         $sidebar = $this->sidebars['wpv-woocommerce'];
     }
     if (isset($post)) {
         $custom_sidebar = wpv_post_meta($post->ID, $place . '_sidebar_type', true);
         if (is_active_sidebar($custom_sidebar . '-' . $place)) {
             $sidebar = $custom_sidebar;
         }
     }
     if (isset($sidebar)) {
         return dynamic_sidebar($sidebar . '-' . $place);
     }
     return dynamic_sidebar($this->sidebars['blog'] . '-' . $place);
 }
function dimox_breadcrumbs($delimiter = '&gt;')
{
    global $post;
    $home = __('Home', 'honeymoon');
    $before = '<span class="current">';
    // tag before the current crumb
    $after = '</span>';
    // tag after the current crumb
    $delim_before = " <span class='delim'>";
    $delim_after = "</span> ";
    $delimiter = $delim_before . $delimiter . $delim_after;
    $homeLink = home_url();
    if (wpv_has_woocommerce() && is_woocommerce()) {
        woocommerce_breadcrumb(array('delimiter' => $delimiter, 'wrap_before' => '', 'wrap_after' => '', 'before' => '', 'after' => '', 'home' => $home));
        return;
    }
    echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter;
    if (!is_home() && !is_front_page() || is_paged()) {
        if (is_category()) {
            global $wp_query;
            $cat_obj = $wp_query->get_queried_object();
            $thisCat = get_category($cat_obj->term_id);
            $parentCat = get_category($thisCat->parent);
            if ($thisCat->parent != 0) {
                echo get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ');
            }
            echo $before . __('Archive by category', 'honeymoon') . ' "' . single_cat_title('', false) . '"' . $after;
        } elseif (is_day()) {
            echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
            echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $delimiter . ' ';
            echo $before . get_the_time('d') . $after;
        } elseif (is_month()) {
            echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
            echo $before . get_the_time('F') . $after;
        } elseif (is_year()) {
            echo $before . get_the_time('Y') . $after;
        } elseif (is_single() && !is_attachment()) {
            $post_type = get_post_type_object(get_post_type());
            if (get_post_type() != 'post') {
                if (get_post_type() == 'portfolio') {
                    echo '<a href="' . wpv_get_option('portfolio-all-items') . '/">' . $post_type->labels->singular_name . '</a> ';
                } else {
                    $slug = $post_type->rewrite;
                    echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ';
                }
                echo $delim_before . ': ' . $delim_after;
                echo $before . get_the_title() . $after;
            } else {
                echo '<a href="' . wpv_get_option('post-all-items') . '/">' . __('Blog', 'honeymoon') . '</a> ';
                $cat = get_the_category();
                if (isset($cat[0])) {
                    echo $delimiter . ' ';
                    $cat = $cat[0];
                    if ($cat !== null) {
                        get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
                    }
                    echo "<a href='" . get_category_link($cat->term_id) . "' title='{$cat->name}'>{$cat->name}</a>";
                }
                echo $delim_before . ': ' . $delim_after;
                echo $before . get_the_title() . $after;
            }
        } elseif (!is_single() && !is_page() && get_post_type() != 'post' && is_object($post)) {
            $post_type = get_post_type_object(get_post_type());
            echo $before . $post_type->labels->singular_name . $after;
        } elseif (is_attachment()) {
            $parent = get_post($post->post_parent);
            $cat = get_the_category($parent->ID);
            if (count($cat) && $cat[0] !== null) {
                get_category_parents($cat[0], TRUE, ' ' . $delimiter . ' ');
            }
            echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a> ' . $delimiter . ' ';
            echo $before . get_the_title() . $after;
        } elseif (is_page() && !$post->post_parent) {
            echo $before . get_the_title() . $after;
        } elseif (is_page() && $post->post_parent) {
            $parent_id = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                $parent_id = $page->post_parent;
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            echo implode(" {$delimiter} ", $breadcrumbs);
            echo $delim_before . ': ' . $delim_after;
            echo $before . get_the_title() . $after;
        } elseif (is_search()) {
            echo $before . __('Search results for', 'honeymoon') . ' "' . get_search_query() . '"' . $after;
        } elseif (is_tag()) {
            echo $before . __('Posts tagged', 'honeymoon') . ' "' . single_tag_title('', false) . '"' . $after;
        } elseif (is_author()) {
            global $author;
            $userdata = get_userdata($author);
            echo $before . __('Articles posted by', 'honeymoon') . ' ' . $userdata->display_name . $after;
        } elseif (is_404()) {
            echo $before . __('Error 404', 'honeymoon') . $after;
        }
        $paged = get_query_var('paged') ? get_query_var('paged') : get_query_var('page');
        if ($paged) {
            $braced = is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author();
            if ($braced) {
                echo ' (';
            }
            echo ' (' . __('Page', 'honeymoon') . ' ' . $paged . ')';
            if ($braced) {
                echo ')';
            }
        }
    }
}