sprintf( esc_html__( 'Display the details of a specific %s', 'bmci' ), edd_get_label_singular() ),
)
);
}
/** @see WP_Widget::widget */
public function widget( $args, $instance ) {
$args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'edd_download_details_widget';
if ( ! isset( $instance['download_id'] ) || ( 'current' == $instance['download_id'] && ! is_singular( 'download' ) ) ) {
return;
}
// set correct download ID
if ( 'current' == $instance['download_id'] && is_singular( 'download' ) ) {
$download_id = get_the_ID();
} else {
$download_id = absint( $instance['download_id'] );
}
// Variables from widget settings
$title = apply_filters( 'widget_title', $instance['title'], $instance, $args['id'] );
$download_title = $instance['download_title'] ? apply_filters( 'edd_product_details_widget_download_title', '
' . get_the_title( $download_id ) . '
', $download_id ) : '';
$purchase_button = $instance['purchase_button'] ? apply_filters( 'edd_product_details_widget_purchase_button', edd_get_purchase_link( array( 'download_id' => $download_id ) ), $download_id ) : '';
$categories = $instance['categories'] ? $instance['categories'] : '';
$tags = $instance['tags'] ? $instance['tags'] : '';
// Used by themes. Opens the widget
echo $args['before_widget']; ?>
0){ ?>
1 ? esc_html__('Category','bmci') : esc_html__('Categories','bmci');
$tag_list = $tags ? get_the_term_list( $download_id, 'download_tag', '', ', ' ) : '';
//$tag_count = count( get_the_terms( $download_id, 'download_tag' ) );
$tag_count = wp_count_terms('download_tag');
$tag_taxonomy = edd_get_taxonomy_labels( 'download_tag' );
$tag_label = $tag_count > 1 ? esc_html__('Tag','bmci') : esc_html__('Tags','bmci');
$text = ''; ?>
';
if( $category_list ) {
$text .= '';
}
if ( $tag_list ) {
$text .= '';
}
$text .= '';
}
do_action( 'edd_product_details_widget_before_categories_and_tags', $instance, $download_id );
printf( $text, $category_label, $category_list, $tag_label, $tag_list );
do_action( 'edd_product_details_widget_before_end', $instance, $download_id ); ?>
sprintf( esc_html__( '%s Details', 'bmci' ), edd_get_label_singular() ),
'display_type' => 'current',
'download_id' => false,
'download_title' => 'on',
'purchase_button' => 'on',
'categories' => 'on',
'tags' => 'on',
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
'download',
'posts_per_page' => -1,
'post_status' => 'publish',
);
$downloads = get_posts( $args );
?>
id="get_field_id( 'download_title' ) ); ?>" name="get_field_name( 'download_title' ) ); ?>" type="checkbox" />
id="get_field_id( 'purchase_button' ) ); ?>" name="get_field_name( 'purchase_button' ) ); ?>" type="checkbox" />
id="get_field_id( 'categories' ) ); ?>" name="get_field_name( 'categories' ) ); ?>" type="checkbox" />
id="get_field_id( 'tags' ) ); ?>" name="get_field_name( 'tags' ) ); ?>" type="checkbox" />