function edit_products_custom_columns($column) { global $post; $meta = get_post_custom(); //unserialize foreach ($meta as $key => $val) { $meta[$key] = maybe_unserialize($val[0]); if (!is_array($meta[$key]) && $key != "mp_is_sale" && $key != "mp_track_inventory" && $key != "mp_product_link") { $meta[$key] = array($meta[$key]); } } switch ($column) { case "thumbnail": if (has_post_thumbnail()) { echo '<a href="' . get_edit_post_link() . '" title="' . __('Edit »') . '">'; the_post_thumbnail(array(50, 50), array('title' => '')); echo '</a>'; } break; case "variations": if (isset($meta["mp_var_name"]) && is_array($meta["mp_var_name"]) && count($meta["mp_var_name"]) > 1) { foreach ($meta["mp_var_name"] as $value) { echo esc_attr($value) . '<br />'; } } else { _e('N/A', 'mp'); } break; case "sku": if (isset($meta["mp_var_name"]) && is_array($meta["mp_var_name"])) { foreach ((array) $meta["mp_sku"] as $value) { echo esc_attr($value) . '<br />'; } } else { _e('N/A', 'mp'); } break; case "pricing": if (isset($meta["mp_price"]) && is_array($meta["mp_price"])) { foreach ($meta["mp_price"] as $key => $value) { if (isset($meta["mp_is_sale"]) && $meta["mp_is_sale"] && isset($meta["mp_sale_price"][$key])) { echo '<del>' . $this->format_currency('', $value) . '</del> '; echo $this->format_currency('', $meta["mp_sale_price"][$key]) . '<br />'; } else { echo $this->format_currency('', $value) . '<br />'; } } } else { echo $this->format_currency('', 0); } break; case "sales": echo number_format_i18n(isset($meta["mp_sales_count"][0]) ? $meta["mp_sales_count"][0] : 0); break; case "stock": if (isset($meta["mp_track_inventory"]) && $meta["mp_track_inventory"]) { foreach ((array) $meta["mp_inventory"] as $value) { $inventory = $value ? $value : 0; if ($inventory == 0) { $class = 'mp-inv-out'; } else { if ($inventory <= $this->get_setting('inventory_threshhold')) { $class = 'mp-inv-warn'; } else { $class = 'mp-inv-full'; } } echo '<span class="' . $class . '">' . number_format_i18n($inventory) . '</span><br />'; } } else { _e('N/A', 'mp'); } break; case "product_categories": echo mp_category_list(); break; case "product_tags": echo mp_tag_list(); break; case "reviews": echo '<div class="post-com-count-wrapper"> <a href="edit-comments.php?p=913" title="0 pending" class="post-com-count"><span class="comment-count">0</span></a> </div>'; break; } }
function framemarket_product_meta() { global $post, $id; $post_id = NULL === $post->ID ? $id : $post->ID; //don't filter outside of the loop if (!in_the_loop()) { return $content; } $content = '<div class="product-meta-details">'; $content .= mp_category_list($post_id, '<span class="grid_mp_product_categories">' . __('Categorized in ', 'mp'), ', ', '</span>'); $content .= ' '; $content .= mp_tag_list($post_id, '<span class="grid_mp_product_tags">' . __('Tagged in ', 'mp'), ', ', '</span>'); $content .= '</div><hr/><div class="product-meta-details">'; $content .= mp_product_price(false); $content .= mp_pinit_button(); $content .= mp_buy_button(false, 'single'); $content .= '</div><hr />'; return $content; }