Initial support to metadata sections.
This commit is contained in:
parent
9df2194b14
commit
84273c9dea
|
@ -200,32 +200,34 @@ if ( !function_exists('tainacan_interface_customize_register_tainacan_items_page
|
|||
*
|
||||
* @return array An associative array with view mode options and the default one
|
||||
*/
|
||||
function tainacan_get_default_view_mode_choices() {
|
||||
$default_view_mode = '';
|
||||
$enabled_view_modes = [];
|
||||
|
||||
if (function_exists('tainacan_get_the_view_modes')) {
|
||||
$view_modes = tainacan_get_the_view_modes();
|
||||
$default_view_mode = $view_modes['default_view_mode'];
|
||||
if ( !function_exists('tainacan_get_default_view_mode_choices') ) {
|
||||
function tainacan_get_default_view_mode_choices() {
|
||||
$default_view_mode = '';
|
||||
$enabled_view_modes = [];
|
||||
|
||||
foreach ($view_modes['registered_view_modes'] as $key => $view_mode) {
|
||||
if (!$view_mode['full_screen'])
|
||||
$enabled_view_modes[$key] = $view_mode['label'];
|
||||
|
||||
if (function_exists('tainacan_get_the_view_modes')) {
|
||||
$view_modes = tainacan_get_the_view_modes();
|
||||
$default_view_mode = $view_modes['default_view_mode'];
|
||||
$enabled_view_modes = [];
|
||||
|
||||
foreach ($view_modes['registered_view_modes'] as $key => $view_mode) {
|
||||
if (!$view_mode['full_screen'])
|
||||
$enabled_view_modes[$key] = $view_mode['label'];
|
||||
}
|
||||
} else {
|
||||
$default_view_mode = 'masonry';
|
||||
$enabled_view_modes = [
|
||||
'masonry' => __('Masonry', 'tainacan-interface'),
|
||||
'cards' => __('Cards', 'tainacan-interface'),
|
||||
'table' => __('Table', 'tainacan-interface'),
|
||||
'grid' => __('Grid', 'tainacan-interface')
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$default_view_mode = 'masonry';
|
||||
$enabled_view_modes = [
|
||||
'masonry' => __('Masonry', 'tainacan-interface'),
|
||||
'cards' => __('Cards', 'tainacan-interface'),
|
||||
'table' => __('Table', 'tainacan-interface'),
|
||||
'grid' => __('Grid', 'tainacan-interface')
|
||||
return [
|
||||
'default_view_mode' => $default_view_mode,
|
||||
'enabled_view_modes' => $enabled_view_modes
|
||||
];
|
||||
}
|
||||
return [
|
||||
'default_view_mode' => $default_view_mode,
|
||||
'enabled_view_modes' => $enabled_view_modes
|
||||
];
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'tainacan_sanitize_items_repository_list_default_view_mode' ) ) :
|
||||
|
|
|
@ -1,76 +1,7 @@
|
|||
<div class="mt-3 tainacan-single-post">
|
||||
|
||||
<?php if ( get_theme_mod('tainacan_single_item_metadata_section_label', '') != '') : ?>
|
||||
<h2 class="title-content-items" id="single-item-metadata-label">
|
||||
<?php echo esc_html( get_theme_mod('tainacan_single_item_metadata_section_label', '') ); ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
<section class="tainacan-content single-item-collection margin-two-column">
|
||||
<div class="single-item-collection--information justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col s-item-collection--metadata">
|
||||
<?php if (has_post_thumbnail() && get_theme_mod( 'tainacan_single_item_display_thumbnail', true )): ?>
|
||||
<div class="tainacan-item-thumbnail-container card border-0 mb-3">
|
||||
<div class="card-body border-0 pl-0 pt-0 pb-1">
|
||||
<h3><?php _e( 'Thumbnail', 'tainacan-interface' ); ?></h3>
|
||||
<?php the_post_thumbnail('tainacan-medium-full', array('class' => 'item-card--thumbnail mt-2')); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!get_theme_mod('tainacan_single_item_collection_header', false) && get_theme_mod( 'tainacan_single_item_display_share_buttons', true )): ?>
|
||||
<div class="card border-0 mb-3">
|
||||
<div class="tainacan-item-share-container card-body border-0 pl-0 pt-0 pb-1">
|
||||
<h3><?php _e( 'Share', 'tainacan-interface' ); ?></h3>
|
||||
<div class="btn-group" role="group">
|
||||
<?php if ( true == get_theme_mod( 'tainacan_facebook_share', true ) ) : ?>
|
||||
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="item-card-link--sharing" target="_blank" title="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/facebook-circle.png'; ?>" alt="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
|
||||
<?php
|
||||
$twitter_option = get_theme_mod( 'tainacan_twitter_user' );
|
||||
$via = ! empty( $twitter_option ) ? '&via=' . esc_attr( get_theme_mod( 'tainacan_twitter_user' ) ) : '';
|
||||
?>
|
||||
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/twitter-circle.png'; ?>" alt="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_whatsapp_share', false ) ) : ?>
|
||||
<a href="https://api.whatsapp.com/send?1=pt_BR&text=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on WhatsApp', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/whatsapp-circle.png'; ?>" alt="<?php esc_attr_e('Share this on WhatsApp', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_telegram_share', false ) ) : ?>
|
||||
<a href="https://t.me/share/url?url=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on Telegram', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/telegram-circle.png'; ?>" alt="<?php esc_attr_e('Share this on Telegram', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<button onclick="copyTextToClipboard('<?php the_permalink(); ?>')" title="<?php esc_attr_e('Copy link', 'tainacan-interface') ?>" class="item-card-link--sharing tainacan-copy-link-button">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/url-circle.png'; ?>" alt="<?php esc_attr_e('Copy link', 'tainacan-interface') ?>">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php do_action( 'tainacan-interface-single-item-metadata-begin' ); ?>
|
||||
<?php
|
||||
$args = array(
|
||||
'display_slug_as_class' => true,
|
||||
'before_title' => '<div><h3>',
|
||||
'after_title' => '</h3>',
|
||||
'before_value' => '<p>',
|
||||
'after_value' => '</p></div>',
|
||||
'exclude_title' => get_theme_mod('tainacan_single_item_hide_core_title_metadata', false)
|
||||
);
|
||||
//$field = null;
|
||||
tainacan_the_metadata( $args );
|
||||
?>
|
||||
<?php do_action( 'tainacan-interface-single-item-metadata-end' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="my-5 border-bottom border-silver"></div>
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_the_metadata_sections') ) { //if (version_compare(TAINACAN_VERSION, '0.19') >= 0) {
|
||||
get_template_part( 'template-parts/single-items-metadata_new' );
|
||||
} else {
|
||||
get_template_part( 'template-parts/single-items-metadata_old' );
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
$metadata_args = array(
|
||||
'display_slug_as_class' => true,
|
||||
'before_title' => '<div><h3>',
|
||||
'after_title' => '</h3>',
|
||||
'before_value' => '<p>',
|
||||
'after_value' => '</p></div>',
|
||||
'exclude_title' => get_theme_mod('tainacan_single_item_hide_core_title_metadata', false)
|
||||
);
|
||||
$args = array(
|
||||
'before' => '<div class="mt-3 tainacan-single-post">',
|
||||
'after' => '</div><div class="my-5 border-bottom border-silver"></div>',
|
||||
'before_name' => '<h2 class="title-content-items">',
|
||||
'after_name' => '</h2>',
|
||||
'before_metadata_list' => do_action( 'tainacan-interface-single-item-metadata-begin' ). '
|
||||
<section class="single-item-collection margin-two-column">
|
||||
<div class="single-item-collection--information justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col s-item-collection--metadata">',
|
||||
'after_metadata_list' => '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>' . do_action( 'tainacan-interface-single-item-metadata-end' ),
|
||||
'metadata_list_args' => $metadata_args
|
||||
);
|
||||
|
||||
tainacan_the_metadata_sections( $args );
|
||||
?>
|
|
@ -0,0 +1,75 @@
|
|||
<div class="mt-3 tainacan-single-post">
|
||||
|
||||
<?php if ( get_theme_mod('tainacan_single_item_metadata_section_label', '') != '') : ?>
|
||||
<h2 class="title-content-items" id="single-item-metadata-label">
|
||||
<?php echo esc_html( get_theme_mod('tainacan_single_item_metadata_section_label', '') ); ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
<section class="tainacan-content single-item-collection margin-two-column">
|
||||
<div class="single-item-collection--information justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col s-item-collection--metadata">
|
||||
<?php if (has_post_thumbnail() && get_theme_mod( 'tainacan_single_item_display_thumbnail', true )): ?>
|
||||
<div class="tainacan-item-thumbnail-container card border-0 mb-3">
|
||||
<div class="card-body border-0 pl-0 pt-0 pb-1">
|
||||
<h3><?php _e( 'Thumbnail', 'tainacan-interface' ); ?></h3>
|
||||
<?php the_post_thumbnail('tainacan-medium-full', array('class' => 'item-card--thumbnail mt-2')); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!get_theme_mod('tainacan_single_item_collection_header', false) && get_theme_mod( 'tainacan_single_item_display_share_buttons', true )): ?>
|
||||
<div class="card border-0 mb-3">
|
||||
<div class="tainacan-item-share-container card-body border-0 pl-0 pt-0 pb-1">
|
||||
<h3><?php _e( 'Share', 'tainacan-interface' ); ?></h3>
|
||||
<div class="btn-group" role="group">
|
||||
<?php if ( true == get_theme_mod( 'tainacan_facebook_share', true ) ) : ?>
|
||||
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="item-card-link--sharing" target="_blank" title="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/facebook-circle.png'; ?>" alt="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
|
||||
<?php
|
||||
$twitter_option = get_theme_mod( 'tainacan_twitter_user' );
|
||||
$via = ! empty( $twitter_option ) ? '&via=' . esc_attr( get_theme_mod( 'tainacan_twitter_user' ) ) : '';
|
||||
?>
|
||||
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/twitter-circle.png'; ?>" alt="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_whatsapp_share', false ) ) : ?>
|
||||
<a href="https://api.whatsapp.com/send?1=pt_BR&text=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on WhatsApp', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/whatsapp-circle.png'; ?>" alt="<?php esc_attr_e('Share this on WhatsApp', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( true == get_theme_mod( 'tainacan_telegram_share', false ) ) : ?>
|
||||
<a href="https://t.me/share/url?url=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing" title="<?php esc_attr_e('Share this on Telegram', 'tainacan-interface') ?>">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/telegram-circle.png'; ?>" alt="<?php esc_attr_e('Share this on Telegram', 'tainacan-interface') ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<button onclick="copyTextToClipboard('<?php the_permalink(); ?>')" title="<?php esc_attr_e('Copy link', 'tainacan-interface') ?>" class="item-card-link--sharing tainacan-copy-link-button">
|
||||
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/url-circle.png'; ?>" alt="<?php esc_attr_e('Copy link', 'tainacan-interface') ?>">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php do_action( 'tainacan-interface-single-item-metadata-begin' ); ?>
|
||||
<?php
|
||||
$args = array(
|
||||
'display_slug_as_class' => true,
|
||||
'before_title' => '<div><h3>',
|
||||
'after_title' => '</h3>',
|
||||
'before_value' => '<p>',
|
||||
'after_value' => '</p></div>',
|
||||
'exclude_title' => get_theme_mod('tainacan_single_item_hide_core_title_metadata', false)
|
||||
);
|
||||
tainacan_the_metadata( $args );
|
||||
?>
|
||||
<?php do_action( 'tainacan-interface-single-item-metadata-end' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="my-5 border-bottom border-silver"></div>
|
Loading…
Reference in New Issue