| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$items = isset( $context['items'] ) && is_array( $context['items'] ) ? $context['items'] : array(); |
| 7 |
?> |
| 8 |
<div class="ebook-store-template-modern"> |
| 9 |
<div class="ebook-store-template-modern__grid<?php echo count( $items ) === 1 ? ' is-single' : ''; ?>"> |
| 10 |
<?php foreach ( $items as $item ) : ?> |
| 11 |
<article class="ebook-modern-card"> |
| 12 |
<div class="ebook-modern-card__media"> |
| 13 |
<div class="ebook-modern-card__cover-frame"> |
| 14 |
<?php if ( ! empty( $item['cover_url'] ) ) : ?> |
| 15 |
<img src="<?php echo esc_url( $item['cover_url'] ); ?>" alt="<?php echo esc_attr( $item['title'] ); ?>" class="ebook-modern-card__cover" /> |
| 16 |
<?php else : ?> |
| 17 |
<div class="ebook-modern-card__cover-placeholder"><?php esc_html_e( 'Ebook cover', 'ebook-store' ); ?></div> |
| 18 |
<?php endif; ?> |
| 19 |
</div> |
| 20 |
<div class="ebook-modern-card__meta-row"> |
| 21 |
<?php if ( ! empty( $item['authors'] ) ) : ?> |
| 22 |
<span class="ebook-modern-chip"><?php echo esc_html( $item['authors'] ); ?></span> |
| 23 |
<?php endif; ?> |
| 24 |
<?php if ( ! empty( $item['publishers'] ) ) : ?> |
| 25 |
<span class="ebook-modern-chip is-soft"><?php echo esc_html( $item['publishers'] ); ?></span> |
| 26 |
<?php endif; ?> |
| 27 |
<?php if ( ! empty( $item['date_text'] ) ) : ?> |
| 28 |
<span class="ebook-modern-chip is-soft"><?php echo esc_html( $item['date_text'] ); ?></span> |
| 29 |
<?php endif; ?> |
| 30 |
<?php if ( ! empty( $item['pages_text'] ) ) : ?> |
| 31 |
<span class="ebook-modern-chip is-soft"><?php echo esc_html( $item['pages_text'] ); ?></span> |
| 32 |
<?php endif; ?> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
<div class="ebook-modern-card__content"> |
| 36 |
<div class="ebook-modern-card__header"> |
| 37 |
<div> |
| 38 |
<h3 class="ebook-modern-card__title"><?php echo esc_html( $item['title'] ); ?></h3> |
| 39 |
<p class="ebook-modern-card__price"><?php echo esc_html( $item['price_display'] ); ?></p> |
| 40 |
</div> |
| 41 |
<?php if ( ! empty( $item['ebook']['donate_or_download'] ) ) : ?> |
| 42 |
<span class="ebook-modern-status"> |
| 43 |
<?php |
| 44 |
if ( $item['ebook']['donate_or_download'] === 'free' ) { |
| 45 |
esc_html_e( 'Free', 'ebook-store' ); |
| 46 |
} elseif ( $item['ebook']['donate_or_download'] === 'donate' ) { |
| 47 |
esc_html_e( 'Donate', 'ebook-store' ); |
| 48 |
} else { |
| 49 |
esc_html_e( 'Paid', 'ebook-store' ); |
| 50 |
} |
| 51 |
?> |
| 52 |
</span> |
| 53 |
<?php endif; ?> |
| 54 |
</div> |
| 55 |
<div class="ebook-modern-card__description"> |
| 56 |
<?php echo $item['content_html']; ?> |
| 57 |
</div> |
| 58 |
<div class="ebook-modern-card__actions"> |
| 59 |
<?php if ( ! empty( $item['preview_url'] ) ) : ?> |
| 60 |
<a class="ebook-modern-button ebook-modern-button--primary" target="_blank" rel="noopener" href="<?php echo esc_url( $item['preview_url'] ); ?>"><?php echo esc_html( isset( $item['preview_label'] ) ? $item['preview_label'] : __( 'Preview', 'ebook-store' ) ); ?></a> |
| 61 |
<?php endif; ?> |
| 62 |
<?php echo $item['add_to_cart_html']; ?> |
| 63 |
<?php echo $item['extra_buttons_html']; ?> |
| 64 |
<?php if ( ! empty( $item['show_primary_buy_link'] ) ) : ?> |
| 65 |
<a style="<?php echo (int) $item['hide_buy_now'] > 0 ? 'display:none;' : ''; ?>" class="ebook_buy_link ebook-modern-button ebook-modern-button--primary" data-md5_nonce="<?php echo esc_attr( $item['md5_nonce'] ); ?>" href="<?php echo esc_url( $item['buy_link_href'] ); ?>" onClick="<?php echo esc_attr( $item['buy_link_onclick'] ); ?>"<?php echo ! empty( $item['primary_payment_method'] ) ? ' data-ebook-store-payment-method="' . esc_attr( $item['primary_payment_method'] ) . '" data-ebook-store-add-payment-info="1" data-ebook-store-begin-checkout="1" data-ebook-store-item-id="' . esc_attr( $item['ebook_id'] ) . '" data-ebook-store-item-name="' . esc_attr( $item['title'] ) . '" data-ebook-store-currency="' . esc_attr( $item['paypal_currency'] ) . '" data-ebook-store-value="' . esc_attr( (string) ebook_store_price_plus_vat( $item['ebook']['ebook_price'] ) ) . '"' : ''; ?>> |
| 66 |
<?php echo esc_html( $item['buy_link_text'] ); ?> |
| 67 |
</a> |
| 68 |
<?php endif; ?> |
| 69 |
<?php echo $item['form_html']; ?> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
</article> |
| 73 |
<?php endforeach; ?> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
|