/** * Hook to remove the 'singular' class, for the twenty eleven theme, to properly display the sidebar * * @param array $classes * @return array */ function fflcommerce_body_classes($classes) { if (!is_content_wrapped()) { return $classes; } $key = array_search('singular', $classes); if ($key !== false) { unset($classes[$key]); } return $classes; }
/** * Evaluates to true for all Jigoshop pages * * @return bool * @since 0.9.9 */ function is_jigoshop() { $is_jigo = false; $is_jigo |= is_content_wrapped(); $is_jigo |= is_account(); $is_jigo |= is_cart(); $is_jigo |= is_checkout(); $is_jigo |= is_order_tracker(); return $is_jigo; }
/** * Properly sets the WP Nav Menus items classes for jigoshop queried objects * * @param $menu_items * @param array $args * @return * @TODO set parent items classes when the shop page is not at the nav menu root */ function jigoshop_nav_menu_items_classes($menu_items, $args) { $options = Jigoshop_Base::get_options(); $shop_page_id = (int) jigoshop_get_page_id('shop'); // only add nav menu classes if the queried object is the Shop page or derivative (Product, Category, Tag) if (empty($shop_page_id) || !is_content_wrapped()) { return $menu_items; } $home_page_id = (int) $options->get('page_for_posts'); foreach ((array) $menu_items as $key => $menu_item) { $classes = (array) $menu_item->classes; // unset classes set by WP on the home page item // shouldn't need a content wrap check as we can't get here without it -JAP- if (is_content_wrapped() && $home_page_id == $menu_item->object_id) { $menu_items[$key]->current = false; unset($classes[array_search('current_page_parent', $classes)]); unset($classes[array_search('current-menu-item', $classes)]); } if (is_shop() && $shop_page_id == $menu_item->object_id) { // is products archive $menu_items[$key]->current = true; $classes[] = 'current-menu-item'; $classes[] = 'current_page_item'; } elseif ((is_product() || is_product_category() || is_product_tag()) && $shop_page_id == $menu_item->object_id) { // is another jigoshop object $classes[] = 'current_page_parent'; $classes[] = 'current_menu_parent'; } $menu_items[$key]->classes = array_unique($classes); } return $menu_items; }
/** * Evaluates to true for all FFL Commerce pages * * @return bool * @since 0.9.9 */ function is_fflcommerce() { $is_fflc = false; $is_fflc |= is_content_wrapped(); $is_fflc |= is_account(); $is_fflc |= is_cart(); $is_fflc |= is_checkout(); $is_fflc |= is_order_tracker(); return $is_fflc; }