function wip_register_js() { #Register the js file for front-end if (!is_admin()) { global $theBuilder_db_version; $woo_lightbox = false; if (woocommerce_found()) { $woo_lightbox = get_option('woocommerce_enable_lightbox') == 'yes' ? true : false; } wp_register_script('easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'), '1.3'); wp_register_script('mousewheel', get_template_directory_uri() . '/js/jquery.mousewheel.js', array('jquery'), '3.0.6'); wp_register_script('scrollPane', get_template_directory_uri() . '/js/jquery.jscrollpane.js', array('jquery', 'mousewheel'), '1.0'); wp_register_script('flowjs', get_template_directory_uri() . '/modules/flowplayer/js/flowplayer-3.2.6.min.js', array('jquery'), '3.2.6'); wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'), '3.1.3'); wp_register_script('selectBox', get_template_directory_uri() . '/js/jquery.selectBox.js', array('jquery')); wp_register_script('nivoSlider', get_template_directory_uri() . '/js/jquery.nivo.slider.js', array('jquery'), '2.7.1'); wp_register_script('global', get_template_directory_uri() . '/js/global.js', array('jquery', 'prettyPhoto'), $theBuilder_db_version); wp_enqueue_script('jquery'); wp_enqueue_script('swfobject'); wp_enqueue_script('easing'); wp_enqueue_script('mousewheel'); wp_enqueue_script('scrollPane'); wp_enqueue_script('flowjs'); wp_enqueue_script('prettyPhoto'); wp_enqueue_script('selectBox'); wp_enqueue_script('nivoSlider'); wp_enqueue_script('global'); wp_localize_script('jquery', 'bdVar', array('ajaxurl' => admin_url('admin-ajax.php'), 'homeurl' => home_url(), 'flowurl' => get_template_directory_uri() . '/modules/flowplayer/flowplayer-3.2.7.swf', 'pp_theme' => get_wip_option_by('bd_pp_style', 'pp_default'), 'cart_pos' => get_wip_option_by('bd_top_cart_pos_action', 'default'), 'use_fancy' => $woo_lightbox ? 'true' : 'false')); } }
> <?php #add boxed_layout class if boxed layout choosen ?> <div class="wrap_990<?php if (_wipfr_is_boxed_layout()) { echo ' boxed_layout'; } ?> "> <div id="main-site"> <?php if (woocommerce_found() && get_option('bd_top_shoppingcart_off') !== '0') { echo _wip_top_cart(); #show top cart, only show when woocommerce active } ?> <!-- TOP SECTION --> <div id="top"> <div class="wrap_940"> <div id="top-inner"<?php _wip_top_inner_logo_class(); ?> > <a id="site-logo"<?php
/** * get number of item in shopping cart * note: not used now, maybe we need this function on next version */ function _wip_get_currentCart_number() { if (woocommerce_found()) { global $woocommerce; return sizeof($woocommerce->cart->get_cart()); } return false; }
function yoast_breadcrumb_cb($prefix = '<div class="breadcrumbs">', $suffix = '</div><div class="clear"></div>', $display = true) { global $wpdb, $wp_query, $post, $query_string; // Load some defaults $br_opt = array(); $br_opt['home'] = __('Home', 'wip'); $br_opt['blog'] = __('Blog', 'wip'); $br_opt['sep'] = '<span class="bread-divider">></span>'; $br_opt['prefix'] = __('', 'wip'); $br_opt['boldlast'] = true; $br_opt['nofollowhome'] = false; $br_opt['singleparent'] = 0; $br_opt['singlecatprefix'] = true; $br_opt['archiveprefix'] = __('Archives for', 'wip'); $br_opt['searchprefix'] = __('Search results for', 'wip'); if (!function_exists('yoast_get_category_parents')) { // Copied and adapted from WP source function yoast_get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE) { $chain = ''; $parent =& get_category($id); if (is_wp_error($parent)) { return $parent; } if ($nicename) { $name = $parent->slug; } else { $name = $parent->name; } if ($parent->parent && $parent->parent != $parent->term_id) { $chain .= get_category_parents($parent->parent, true, $separator, $nicename); } $chain .= bold_take_not($name); return $chain; } } function WIPTakeTaxonomyParent($id, $taxName = 'category', $separator) { if ($id == '') { $id = 0; } if (!is_object($id)) { $id = (int) $id; } if ($taxName == '') { return $id; } $parents = get_term_by('id', $id, $taxName); $parent = ''; if ($parents->parent && $parents->parent != $id) { $par = get_term_by('id', $parents->parent, $taxName); if (WIPTakeTaxonomyParent($par->term_id, $taxName, '')) { $parent = WIPTakeTaxonomyParent($par->term_id, $taxName, $separator); } $parent .= '<a href="' . get_term_link((int) $parents->parent, $taxName) . '">' . $par->name . '</a> '; if ($separator) { $parent .= $separator; } return $parent; } return false; } $prepend = ''; if (woocommerce_found() && (get_option('woocommerce_prepend_shop_page_to_urls') == "yes" && woocommerce_get_page_id('shop') && get_option('page_on_front') !== woocommerce_get_page_id('shop'))) { $prepend = '<a href="' . get_permalink(woocommerce_get_page_id('shop')) . '">' . get_the_title(woocommerce_get_page_id('shop')) . '</a> ' . $br_opt['sep']; } $nofollow = ' '; if ($br_opt['nofollowhome']) { $nofollow = ' rel="nofollow" '; } $on_front = get_option('show_on_front'); if ($on_front == "page") { $homelink = '<a' . $nofollow . 'href="' . get_permalink(get_option('page_on_front')) . '" class="breadcrumb_home">' . $br_opt['home'] . '</a>'; $bloglink = $homelink . $br_opt['sep'] . ' <a href="' . get_permalink(get_option('page_for_posts')) . '">' . $br_opt['blog'] . '</a>'; } else { $homelink = '<a' . $nofollow . 'href="' . home_url() . '" class="breadcrumb_home" title="' . __('Homepage', 'wip') . '">' . $br_opt['home'] . '</a>'; $bloglink = $homelink; } if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) { $output = bold_take_not($br_opt['home']); } elseif ($on_front == "page" && is_home()) { $output = $homelink . $br_opt['sep'] . bold_take_not($br_opt['blog']); } elseif (!is_page()) { $output = $bloglink . $br_opt['sep']; if ((is_single() || is_category() || is_tag() || is_date() || is_author()) && $br_opt['singleparent'] != false) { $output .= '<a href="' . get_permalink($br_opt['singleparent']) . '">' . get_the_title($br_opt['singleparent']) . '</a> ' . $br_opt['sep']; } if (is_single() && $br_opt['singlecatprefix']) { $p_type = get_post_type(); if ($p_type == "post") { $cats = get_the_category(); $cat = $cats[0]; if (is_object($cat)) { if (WIPTakeTaxonomyParent($cat->term_id, 'category', '')) { $output .= WIPTakeTaxonomyParent($cat->term_id, 'category', $br_opt['sep']); } $output .= '<a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a>' . $br_opt['sep']; } } else { if ($p_type == "product") { $output .= $prepend; $trm = wp_get_object_terms($post->ID, 'product_cat'); $trms = $trm[0]; $tera = get_term_by('id', $trms->term_id, 'product_cat'); $tera_link = get_term_link((int) $trms->term_id, 'product_cat'); if ($trm) { if (WIPTakeTaxonomyParent($tera->term_id, 'product_cat', '')) { $output .= WIPTakeTaxonomyParent($tera->term_id, 'product_cat', $br_opt['sep']); } $output .= '<a href="' . $tera_link . '">' . $tera->name . '</a>'; $output .= $br_opt['sep']; } } else { if ($p_type == "portfolio-item") { $trm = wp_get_object_terms($post->ID, 'portfolio-category'); $trms = $trm[0]; $tera = get_term_by('id', $trms->term_id, 'portfolio-category'); $tera_link = get_term_link((int) $trms->term_id, 'portfolio-category'); if ($trm) { if (WIPTakeTaxonomyParent($tera->term_id, 'portfolio-category', '')) { $output .= WIPTakeTaxonomyParent($tera->term_id, 'portfolio-category', $br_opt['sep']); } $output .= '<a href="' . $tera_link . '">' . $tera->name . '</a>'; $output .= $br_opt['sep']; } } } } } elseif (woocommerce_found() && (is_post_type_archive('product') && get_option('page_on_front') !== woocommerce_get_page_id('shop'))) { $_name = woocommerce_get_page_id('shop') ? get_the_title(woocommerce_get_page_id('shop')) : ucwords(get_option('woocommerce_shop_slug')); if (is_search()) { $output .= '<a href="' . get_post_type_archive_link('product') . '">' . $_name . '</a>' . $br_opt['sep']; $output .= bold_take_not(sprintf(__('Search results for “%s“', 'woocommerce'), get_search_query())); } else { $output .= bold_take_not($_name); } } if (is_category()) { $cat = intval(get_query_var('cat')); $output .= yoast_get_category_parents($cat, false, $br_opt['sep']); } elseif (is_tag()) { $output .= bold_take_not($br_opt['archiveprefix'] . single_cat_title('', false)); } elseif (is_date()) { $output .= bold_take_not($br_opt['archiveprefix'] . single_month_title(' ', false)); } elseif (is_author()) { $user = wp_title("", false); $output .= bold_take_not($br_opt['archiveprefix'] . $user); } elseif (is_search()) { if (!is_post_type_archive('product')) { $output .= bold_take_not($br_opt['searchprefix'] . '"' . stripslashes(strip_tags(get_search_query())) . '"'); } } else { if (is_tax('product_cat')) { $output .= $prepend; $termos = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if (WIPTakeTaxonomyParent($termos->term_id, 'product_cat', '')) { $output .= WIPTakeTaxonomyParent($termos->term_id, 'product_cat', $br_opt['sep']); } $output .= bold_take_not($termos->name); } else { if (is_tax('product_tag')) { $output .= $prepend; $queried_object = $wp_query->get_queried_object(); $output .= bold_take_not($queried_object->name); } else { if (is_tax('portfolio-category')) { $termos = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if (WIPTakeTaxonomyParent($termos->term_id, 'portfolio-category', '')) { $output .= WIPTakeTaxonomyParent($termos->term_id, 'portfolio-category', $br_opt['sep']); } $output .= bold_take_not($termos->name); } else { if (!is_post_type_archive('product')) { $output .= bold_take_not(get_the_title()); } } } } } } else { $post = $wp_query->get_queried_object(); if ($post->post_type == 'page') { // If this is a top level Page, it's simple to output the breadcrumb if (0 == $post->post_parent) { $output = $homelink . $br_opt['sep'] . bold_take_not(get_the_title()); } else { if (isset($post->ancestors)) { if (is_array($post->ancestors)) { $ancestors = array_values($post->ancestors); } else { $ancestors = array($post->ancestors); } } else { $ancestors = array($post->post_parent); } // Reverse the order so it's oldest to newest $ancestors = array_reverse($ancestors); // Add the current Page to the ancestors list (as we need it's title too) $ancestors[] = $post->ID; $links = array(); foreach ($ancestors as $ancestor) { $tmp = array(); $tmp['title'] = strip_tags(get_the_title($ancestor)); $tmp['url'] = get_permalink($ancestor); $tmp['cur'] = false; if ($ancestor == $post->ID) { $tmp['cur'] = true; } $links[] = $tmp; } $output = $homelink; foreach ($links as $link) { $output .= ' ' . $br_opt['sep'] . ' '; if (!$link['cur']) { $output .= '<a href="' . $link['url'] . '">' . $link['title'] . '</a>'; } else { $output .= bold_take_not($link['title']); } } } } } if ($br_opt['prefix'] != "") { $output = $br_opt['prefix'] . " " . $output; } if ($display) { echo $prefix . $output . $suffix; } else { return $prefix . $output . $suffix; } }
function _content_for_column($type, $fields = "") { $colContent = ""; switch ($type) { case 'paragraph-text': $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? isset($fields[2]) && $fields[2] !== '' ? apply_filters('the_content', stripslashes(wptexturize($fields[1]))) : stripslashes(wptexturize($fields[1])) : ''; break; case 'latest-post': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 5; $usethumbnail = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] !== "") ? true : false; $showexcerpt = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] !== "") ? true : false; $catID = isset($fields[4]) && $fields[4] == 'all' ? 0 : intval($fields[4]); $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= wipfr_latest_blog($count, $usethumbnail, $showexcerpt, 66, $catID); break; case 'latest-portfolio-thumbnail': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 6; $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]); $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= wipfr_latest_portfolio_thumbnail($count, $catID); break; case 'latest-product': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 6; $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]); $featured = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] != "") ? true : false; $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; if (woocommerce_found()) { $colContent .= _wip_latest_woo_product($count, $catID, $featured); } else { $colContent .= __('Please activate WooCommerce Plugin!', 'wip'); } break; case 'latest-post-column': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3; $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]); $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= wip_layout_helper::_print_column_blog_lists($count, $catID); break; case 'latest-tweet': $count = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? $fields[2] : 4; $twitterUser = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] !== "") ? esc_attr($fields[1]) : ''; $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; if ($twitterUser != "") { $colContent .= _wip_display_tweets($twitterUser, $count); } else { $colContent .= __('Cannot process request! Twitter username is blank!', 'wip'); } break; case 'flickr-photo': $count = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? $fields[2] : 9; $flickrID = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] !== "") ? esc_attr($fields[1]) : ''; $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; if ($flickrID != "") { $colContent .= wip_display_flickr($flickrID, $count); } else { $colContent .= __('Cannot process request! Please enter your Flickr ID!', 'wip'); } break; case 'box-testimonial': $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? wpautop(stripslashes(wptexturize('<span class="before_quote">“</span>' . $fields[1] . '<span class="after_quote">„</span>'))) : ''; $colContent .= $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? stripslashes(wptexturize('<span class="testi_writer">— ' . $fields[2] . '</span>')) : '<span class="testi_writer">— No Body</span>'; break; case 'latest-product-column': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3; $prodCat = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]); $featured = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] != "") ? true : false; $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; if (woocommerce_found()) { $colContent .= _wip_show_product_lists_for_manager(34, $count, $prodCat, $featured, false); } else { $colContent .= __('Please activate WooCommerce Plugin!', 'wip'); } break; case 'latest-portfolio-column': $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3; $portCat = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]); $colContent .= isset($fields[0]) && $fields[0] != "" ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : ''; $colContent .= wip_layout_helper::_print_column_portfolio_lists($count, $portCat); break; } return $colContent; }
<?php # Only call all functions below, if only WooCommerce is active if (woocommerce_found()) { global $wpdb, $wp_query, $woocommerce; if (!is_admin()) { define('WOOCOMMERCE_USE_CSS', false); } add_action('wp_print_styles', 'wip_woo_custom_css'); function wip_woo_custom_css() { if (!is_admin()) { wp_register_style('wip_woocommerce', get_template_directory_uri() . '/css/woocommerce_custom.css', array('wip_base'), '1.0'); wp_enqueue_style('wip_woocommerce'); } } /** * throw global variable if single product page detected! * helps alot to define the layout! */ add_filter('wp_head', 'wip_detect_single_product'); function wip_detect_single_product() { global $query, $wp_query; if (is_single() && get_post_type() == 'product' || is_page(woocommerce_get_page_id('cart'))) { $GLOBALS['wip_woo_single'] = true; } else { $GLOBALS['wip_woo_single'] = false; //reset } }