/** * Render Wish List Columns * * @since 1.0 * @param string $column_name Column name * @param int $post_id Download (Post) ID * @return void */ function edd_wl_render_admin_columns($column_name, $post_id) { if (get_post_type($post_id) == 'edd_wish_list') { $items = get_post_meta(get_the_ID(), 'edd_wish_list', true); switch ($column_name) { case 'downloads': if ($items) { echo count($items); } else { echo 0; } break; case 'total': echo edd_wl_get_list_total(get_the_ID()); break; case 'list_author': $post = get_post(); if (0 == $post->post_author) { echo __('Guest', 'edd-wish-lists'); } else { printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author()); } break; } } }
/** * Show the items in each list * * @since 1.0 * @return void */ function edd_wl_items_in_list_meta_box() { $items = get_post_meta(get_the_ID(), 'edd_wish_list', true); if ($items) { foreach ($items as $item) { $item_option = !empty($item['options']) ? '<span class="edd-wl-item-title-option"> – ' . edd_get_cart_item_price_name($item) . '</span>' : ''; ?> <p> <a href="<?php echo admin_url('post.php?post=' . $item['id'] . '&action=edit'); ?> "><?php echo get_the_title($item['id']); ?> </a> <?php echo $item_option; ?> <?php echo '<br />' . edd_cart_item_price($item['id'], $item['options']); ?> </p> <?php } ?> <p><strong><?php echo __('Total:', 'edd-wish-lists') . ' ' . edd_wl_get_list_total(get_the_ID()); ?> </strong></p> <?php } else { _e('No items have been added yet', 'edd-wish-lists'); } ?> <?php }
/** * Displays the total price of downloads in a wishlist * @param int $list_id ID of lsit * @return string total * @uses edd_wl_get_list_total() * @since 1.0 */ function edd_wl_list_total($list_id) { // get the list total $total = edd_wl_get_list_total($list_id); echo apply_filters('edd_wl_list_total', '<p>' . __(' Total: ', 'edd-wish-lists') . $total . '</p>'); }