/**
  * Check if current page is wishlist
  *
  * @return bool
  * @since 2.0.13
  */
 function yith_wcwl_is_wishlist_page()
 {
     $wishlist_page_id = yith_wcwl_object_id(get_option('yith_wcwl_wishlist_page_id'));
     if (!$wishlist_page_id) {
         return false;
     }
     return is_page($wishlist_page_id);
 }
 /**
  * Build wishlist page URL.
  * 
  * @return string
  * @since 1.0.0
  */
 public function get_wishlist_url($action = 'view')
 {
     global $sitepress;
     $wishlist_page_id = yith_wcwl_object_id(get_option('yith_wcwl_wishlist_page_id'));
     if (get_option('permalink_structure') && !defined('ICL_PLUGIN_PATH')) {
         $wishlist_permalink = trailingslashit(get_the_permalink($wishlist_page_id));
         $base_url = trailingslashit($wishlist_permalink . $action);
     } else {
         $base_url = get_the_permalink($wishlist_page_id);
         $action_params = explode('/', $action);
         $params = array();
         if (isset($action_params[1])) {
             $action = $action_params[0];
             $params['wishlist-action'] = $action;
             if ($action == 'view') {
                 $params['wishlist_id'] = $action_params[1];
             } elseif ($action == 'user') {
                 $params['user_id'] = $action_params[1];
             }
         } else {
             $params['wishlist-action'] = $action;
         }
         $base_url = add_query_arg($params, $base_url);
     }
     if (defined('ICL_PLUGIN_PATH') && $sitepress->get_current_language() != $sitepress->get_default_language()) {
         $base_url = add_query_arg('lang', $sitepress->get_current_language(), $base_url);
     }
     return apply_filters('yith_wcwl_wishlist_page_url', esc_url_raw($base_url));
 }
 /**
  * Add specific body class when the Wishlist page is opened
  *
  * @param array $classes
  *
  * @return array
  * @since 1.0.0
  */
 public function add_body_class($classes)
 {
     $wishlist_page_id = yith_wcwl_object_id(get_option('yith_wcwl_wishlist_page_id'));
     if (is_page($wishlist_page_id)) {
         $classes[] = 'woocommerce-wishlist';
         $classes[] = 'woocommerce';
         $classes[] = 'woocommerce-page';
     }
     return $classes;
 }
Example #4
0
 /**
  * Get page sidebar
  *
  * @param null $post_id
  * @return mixed|void
  */
 function cruxstore_get_page_sidebar($post_id = null)
 {
     global $post;
     if (!$post_id) {
         $post_id = $post->ID;
     }
     $sidebar = array('sidebar' => cruxstore_meta('_cruxstore_sidebar', array(), $post_id), 'sidebar_area' => '');
     if (isset($_REQUEST['sidebar'])) {
         $sidebar['sidebar'] = $_REQUEST['sidebar'];
     }
     if (cruxstore_is_wc()) {
         if (is_cart() || is_checkout() || is_account_page()) {
             $sidebar['sidebar'] = 'full';
         } elseif (defined('YITH_WCWL')) {
             $wishlist_page_id = yith_wcwl_object_id(get_option('yith_wcwl_wishlist_page_id'));
             if ($post_id == $wishlist_page_id) {
                 $sidebar['sidebar'] = 'full';
             }
         }
     }
     if ($sidebar['sidebar'] == '' || $sidebar['sidebar'] == 'default') {
         $sidebar['sidebar'] = cruxstore_option('page_sidebar', '');
         if ($sidebar['sidebar'] == 'left') {
             $sidebar['sidebar_area'] = cruxstore_option('page_sidebar_left', 'primary-widget-area');
         } elseif ($sidebar['sidebar'] == 'right') {
             $sidebar['sidebar_area'] = cruxstore_option('page_sidebar_right', 'primary-widget-area');
         }
     } elseif ($sidebar['sidebar'] == 'left') {
         $sidebar['sidebar_area'] = cruxstore_meta('_cruxstore_left_sidebar', array(), $post_id);
     } elseif ($sidebar['sidebar'] == 'right') {
         $sidebar['sidebar_area'] = cruxstore_meta('_cruxstore_right_sidebar', array(), $post_id);
     }
     if ($sidebar['sidebar'] == 'full') {
         $sidebar['sidebar'] = '';
     }
     return apply_filters('cruxstore_page_sidebar', $sidebar);
 }