本文整理汇总了PHP中edd_price函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_price函数的具体用法?PHP edd_price怎么用?PHP edd_price使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkout_download_meta
/**
* Download meta list
*
* @since 1.0
*/
function checkout_download_meta()
{
global $post;
?>
<div class="download-meta">
<div class="download-meta-price download-price-toggle">
<div class="download-meta-price-details">
<?php
if (edd_has_variable_prices(get_the_ID())) {
?>
<!-- Get the price range -->
<a href="<?php
the_permalink();
?>
" rel="bookmark"><?php
echo checkout_edd_price_range();
?>
</a>
<?php
} else {
if (edd_is_free_download(get_the_ID())) {
?>
<!-- Get free download text -->
<a href="<?php
the_permalink();
?>
" rel="bookmark"><span class="edd_price"><?php
_e('Free', 'checkout');
?>
</span></a>
<?php
} else {
?>
<!-- Get the price range -->
<a href="<?php
the_permalink();
?>
" rel="bookmark"><?php
edd_price(get_the_ID());
?>
</a>
<?php
}
}
?>
<span class="close-pricing"><?php
_e('Close', 'checkout');
?>
</span>
</div>
</div>
<div class="download-meta-name">
<?php
if (class_exists('EDD_Front_End_Submissions')) {
?>
<?php
printf('<span class="author vcard"><a rel="author" class="fn" href="%1$s" title="%2$s">%3$s %4$s</a></span>', checkout_fes_author_url(get_the_author_meta('ID')), esc_attr(sprintf(__('View all posts by %s', 'checkout'), get_the_author())), get_avatar(get_the_author_meta('ID'), 20), esc_html(get_the_author_meta('display_name')));
?>
<?php
} else {
?>
<a href="<?php
the_permalink();
?>
" rel="bookmark"><?php
_e('View Details', 'checkout');
?>
</a>
<?php
}
?>
</div>
</div><!-- .download-meta -->
<?php
}
示例2: edd_render_download_columns
/**
* Render Download Columns
*
* @since 1.0
* @param string $column_name Column name
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
global $edd_options;
$style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
$purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
if (edd_has_variable_prices($post_id)) {
echo edd_price_range($post_id);
} else {
echo edd_price($post_id, false);
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
echo edd_get_download_sales_stats($post_id);
break;
case 'earnings':
echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例3: edd_render_download_columns
/**
* Render Donwload Columns
*
* Render the custom columns content.
*
* @access private
* @since 1.0
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
$sales = edd_get_download_sales_stats($post_id);
$earnings = edd_get_download_earnings_stats($post_id);
$color = get_post_meta($post_id, '_edd_purchase_color', true);
$color = $color ? $color : 'blue';
$purchase_text = get_post_meta($post_id, '_edd_purchase_text', true);
$purchase_text = $purchase_text && '' !== $purchase_text ? $purchase_text : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
echo edd_price($post_id, false);
if (!edd_has_variable_prices($post_id)) {
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
echo $sales;
break;
case 'earnings':
echo edd_currency_filter($earnings);
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="button" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例4: widget
/**
* Display the widget content.
*
* @since 1.0
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget($args, $instance)
{
// Merge with defaults
$instance = wp_parse_args((array) $instance, $this->defaults);
// Return early if we have no download ID or no variable prices
if (!isset($instance['download'])) {
return;
}
// Set the download ID
$download_id = absint($instance['download']);
// Get the featured price option
$featured = isset($instance['featured']) && !empty($instance['featured']) ? 'featured' : null;
// Set the title
$title = get_the_title($download_id);
echo $args['before_widget'];
?>
<div itemscope class="pricing-table <?php
echo $featured;
?>
">
<div class="pricing-table-top">
<div class="pricing-table-price">
<?php
edd_price($download_id);
?>
</div>
<div class="pricing-table-price-desc"><?php
echo esc_html($title);
?>
</div>
</div>
<div class="pricing-table-features">
<?php
checkout_edd_download_details($download_id);
?>
<a class="button" href="<?php
echo edd_get_checkout_uri();
?>
?edd_action=add_to_cart&download_id=<?php
echo absint($download_id);
?>
" title="<?php
echo esc_attr($title);
?>
">
<?php
_e('Buy Now', 'checkout');
?>
</a>
</div>
</div>
<?php
echo $args['after_widget'];
}
示例5: download_price_function
function download_price_function($atts)
{
$atts = shortcode_atts(array('limit' => -1, 'id' => ''), $atts, 'download_price');
if ($atts['id'] != '') {
$id = $atts['id'];
} else {
$id = get_the_id();
}
if (edd_has_variable_prices($id)) {
$get_default_price = edd_get_default_variable_price($id);
return edd_price($id, false, $get_default_price);
} else {
return edd_price($id, false);
}
}
示例6: edd_render_download_columns
/**
* Render Download Columns
*
* @since 1.0
* @param string $column_name Column name
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
global $edd_options;
$style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
$color = $color == 'inherit' ? '' : $color;
$purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
if (edd_has_variable_prices($post_id)) {
echo edd_price_range($post_id);
} else {
echo edd_price($post_id, false);
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
if (current_user_can('view_product_stats', $post_id)) {
echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
echo edd_get_download_sales_stats($post_id);
echo '</a>';
} else {
echo '-';
}
break;
case 'earnings':
if (current_user_can('view_product_stats', $post_id)) {
echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
echo '</a>';
} else {
echo '-';
}
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例7: edd_render_download_columns
/**
* Render Download Columns
*
* @since 1.0
* @param string $column_name Column name
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
if (edd_has_variable_prices($post_id)) {
echo edd_price_range($post_id);
} else {
echo edd_price($post_id, false);
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
if (current_user_can('view_product_stats', $post_id)) {
echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
echo edd_get_download_sales_stats($post_id);
echo '</a>';
} else {
echo '-';
}
break;
case 'earnings':
if (current_user_can('view_product_stats', $post_id)) {
echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
echo '</a>';
} else {
echo '-';
}
break;
}
}
}
示例8: edd_rp_render_shortcode
function edd_rp_render_shortcode($attributes, $content = null)
{
global $post;
extract(shortcode_atts(array('ids' => $post->id, 'user' => 'false', 'count' => 3, 'title' => __('Recommended Products', EDD_RP_TEXT_DOMAIN)), $attributes, 'recommended_products'));
$ids = str_replace(' ', '', $ids);
$ids = explode(',', $ids);
$count = absint($count);
$user_id = $user == 'true' ? get_current_user_id() : false;
$suggestions = edd_rp_get_multi_suggestions($ids, $user_id, $count);
if (is_array($suggestions) && !empty($suggestions)) {
$suggestions = array_keys($suggestions);
$suggested_downloads = new WP_Query(array('post__in' => $suggestions, 'post_type' => 'download'));
if ($suggested_downloads->have_posts()) {
?>
<div id="edd-rp-single-wrapper">
<h5 id="edd-rp-single-header"><?php
echo $title;
?>
</h5>
<div id="edd-rp-items-wrapper" class="edd-rp-single">
<?php
while ($suggested_downloads->have_posts()) {
?>
<?php
$suggested_downloads->the_post();
?>
<div class="edd-rp-item <?php
echo !current_theme_supports('post-thumbnails') ? 'edd-rp-nothumb' : '';
?>
">
<a href="<?php
the_permalink();
?>
">
<?php
the_title();
?>
<?php
if (current_theme_supports('post-thumbnails') && has_post_thumbnail(get_the_ID())) {
?>
<div class="edd_cart_item_image">
<?php
echo get_the_post_thumbnail(get_the_ID(), apply_filters('edd_checkout_image_size', array(125, 125)));
?>
</div>
<?php
} else {
?>
<br />
<?php
}
?>
</a>
<?php
if (!edd_has_variable_prices(get_the_ID())) {
?>
<?php
edd_price(get_the_ID());
?>
<?php
}
?>
<?php
echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'price' => false, 'direct' => false));
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
<?php
wp_reset_postdata();
?>
<?php
}
}
示例9: sprintf
<span class="tribe-tickets-remaining">
<?php
echo sprintf(esc_html__('%1$s available', 'event-tickets-plus'), '<span class="available-stock" ' . $data_product_id . '>' . esc_html($remaining) . '</span>');
?>
</span>
<?php
}
} else {
echo '<span class="tickets_nostock">' . esc_html__('Out of stock!', 'event-tickets-plus') . '</span>';
}
echo '</td>';
echo '<td class="tickets_name">';
echo $ticket->name;
echo '</td>';
echo '<td class="tickets_price">';
echo edd_price($product->ID);
echo '</td>';
echo '<td class="tickets_description">';
echo $ticket->description;
echo '</td>';
echo '</tr>';
echo '<tr class="tribe-tickets-attendees-list-optout">' . '<td colspan="4">' . '<input type="checkbox" name="optout_' . esc_attr($ticket->ID) . '" id="tribe-tickets-attendees-list-optout-edd">' . '<label for="tribe-tickets-attendees-list-optout-edd">' . esc_html__('Don\'t list me on the public attendee list', 'event-tickets') . '</label>' . '</td>' . '</tr>';
include Tribe__Tickets_Plus__Main::instance()->get_template_hierarchy('meta.php');
}
}
?>
<?php
if ($is_there_any_product_to_sell) {
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'gray';
$color = $color == 'inherit' ? '' : $color;
示例10: the_post_thumbnail
<div class="entry-content single-content clearfix">
<?php
the_post_thumbnail('large');
?>
<?php
the_content();
?>
<a class="btn btn-primary" role="button" href="<?php
bloginfo('url');
?>
/checkout?edd_action=add_to_cart&download_id=<?php
echo get_the_ID();
?>
"><?php
edd_price($post->ID);
?>
Buy the PDF</a>
<?php
if (get_field('books_amazon_print_link') !== '') {
?>
<a role="button" class="btn btn-primary" href="<?php
the_field('books_amazon_print_link');
?>
" >Buy print edition</a>
<?php
}
?>
<p id="history" class="description"><em>Sensitive Skin</em> features art, writing and music, without rules or boundaries, by both famous and emerging artists, writers, and musicians from around the globe.
示例11: get_field
}
?>
<?php
if (get_field('pdf_link') !== '') {
//enter the download ID in the pdf_link field for the book
$postID = get_field('pdf_link');
?>
<a class="btn btn-primary" role="button" href="<?php
bloginfo('url');
?>
/checkout?edd_action=add_to_cart&download_id=<?php
the_field('pdf_link');
?>
; ?>"><?php
edd_price($postID);
?>
Buy the PDF</a>
<?php
}
?>
<?php
if (get_field('manual_link') !== '') {
?>
<?php
the_field('manual_link');
?>
<?php
}
?>
示例12: elseif
} elseif ($item_key == 'wc_sku') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_product = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('woocommerce/woocommerce.php', (array) $active_plugins) && $is_product == 'product') {
global $woocommerce, $product;
$sku = $product->get_sku();
$html_content .= $sku;
}
$html_content .= '</div>';
} elseif ($item_key == 'edd_price') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_download = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('easy-digital-downloads/easy-digital-downloads.php', (array) $active_plugins) && $is_download == 'download') {
$edd_price = edd_price(get_the_ID(), false);
$html_content .= $edd_price;
}
$html_content .= '</div>';
} elseif ($item_key == 'edd_variable_prices') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_download = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('easy-digital-downloads/easy-digital-downloads.php', (array) $active_plugins) && $is_download == 'download') {
$prices = edd_get_variable_prices(get_the_ID());
if ($prices) {
$html_price = '';
$html_price .= '<ul>';
foreach ($prices as $price_id => $price) {
$html_price .= '<li>' . $price['name'] . ': ' . $price['amount'] . '</li>';
//is the name of the price
示例13: marketify_purchase_link
?>
<div class="actions">
<?php
marketify_purchase_link(get_the_ID());
?>
<a href="<?php
the_permalink();
?>
" rel="bookmark" class="button"><?php
_e('Details', 'marketify');
?>
</a>
<strong class="item-price"><span><?php
printf(__('Item Price: %s', 'marketify'), edd_price(get_the_ID(), false));
?>
</span></strong>
<?php
do_action('marketify_download_content_image_overlay_after');
?>
</div>
</div>
<?php
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::get_the_post_thumbnail('download', 'grid-image')) {
?>
<?php
MultiPostThumbnails::the_post_thumbnail('download', 'grid-image', null, 'content-grid-download');
?>
示例14: wplms_edd_course_credits
function wplms_edd_course_credits($credits, $course_id)
{
if (in_array('easy-digital-downloads/easy-digital-downloads.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$edd_product = get_post_meta($course_id, 'vibe_edd_download', true);
if (isset($edd_product) && is_numeric($edd_product)) {
ob_start();
edd_price($edd_product);
$price = ob_get_contents();
ob_end_clean();
$private = apply_filters('wplms_private_course_label', __('PRIVATE'));
if (strpos($credits, $private) !== false) {
$credits = $price;
} else {
$credits .= $price;
}
}
}
return $credits;
}
示例15: edd_download_price_shortcode
/**
* Price Shortcode
*
* Shows the price of a download.
*
* @since 1.1.3.3
* @param array $atts Shortcode attributes
* @param string $content
* @return string
*/
function edd_download_price_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('id' => NULL), $atts));
if (is_null($id)) {
$id = get_the_ID();
}
return edd_price($id, false);
}