Initial support to metadata sections.

This commit is contained in:
mateuswetah 2022-05-09 16:57:04 -03:00
parent 2eb4b6cdeb
commit cb1a928359
3 changed files with 65 additions and 32 deletions

View File

@ -1,32 +1,7 @@
<?php
$prefix = blocksy_manager()->screen->get_prefix();
?>
<section class="tainacan-item-section tainacan-item-section--metadata">
<?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'tainacan-blocksy' )) != '' ) : ?>
<h2 class="tainacan-single-item-section" id="tainacan-item-metadata-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'tainacan-blocksy' ) ) ); ?>
</h2>
<?php endif; ?>
<div class="tainacan-item-section__metadata <?php echo get_theme_mod($prefix . '_metadata_list_structure_type', 'metadata-type-1') ?>">
<?php if (has_post_thumbnail() && (get_theme_mod($prefix . '_show_thumbnail', 'no') === 'yes') ): ?>
<div class="tainacan-item-section__metadata-thumbnail">
<h3 class="tainacan-metadata-label"><?php _e( 'Thumbnail', 'tainacan-blocksy' ); ?></h3>
<p class="tainacan-metadata-value"><?php the_post_thumbnail('tainacan-medium-full'); ?></p>
</div>
<?php endif; ?>
<?php do_action( 'tainacan-blocksy-single-item-metadata-begin' ); ?>
<?php
$args = array(
'display_slug_as_class' => true,
'before_title' => '<h3 class="tainacan-metadata-label">',
'after_title' => '</h3>',
'before_value' => '<p class="tainacan-metadata-value">',
'after_value' => '</p>',
'exclude_title' => (get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no')
);
tainacan_the_metadata( $args );
?>
<?php do_action( 'tainacan-blocksy-single-item-metadata-end' ); ?>
</div>
</section>
<?php
if ( function_exists('tainacan_get_the_metadata_sections') ) { //if (version_compare(TAINACAN_VERSION, '0.19RC') >= 0) {
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-metadata_new' );
} else {
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-metadata_old' );
}
?>

View File

@ -0,0 +1,26 @@
<?php
$prefix = blocksy_manager()->screen->get_prefix();
$metadata_args = array(
'display_slug_as_class' => true,
'before_title' => '<h3 class="tainacan-metadata-label">',
'after_title' => '</h3>',
'before_value' => '<p class="tainacan-metadata-value">',
'after_value' => '</p>',
'exclude_title' => (get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no')
);
$args = array(
'before' => '<section class="tainacan-item-section tainacan-item-section--metadata">',
'after' => '</section>',
'before_name' => '<h2 class="tainacan-single-item-section">',
'after_name' => '</h2>',
'hide_name' => !get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes',
'before_metadata_list' => do_action( 'tainacan-blocksy-single-item-metadata-begin' ) . '<div class="tainacan-item-section__metadata ' . get_theme_mod($prefix . '_metadata_list_structure_type', 'metadata-type-1') . '">',
'after_metadata_list' => '</div>' . do_action( 'tainacan-blocksy-single-item-metadata-end' ),
'metadata_list_args' => $metadata_args
);
echo '<div class="tainacan-metadata-sections-container">';
tainacan_the_metadata_sections( $args );
echo '</div>';
?>

View File

@ -0,0 +1,32 @@
<?php
$prefix = blocksy_manager()->screen->get_prefix();
?>
<section class="tainacan-item-section tainacan-item-section--metadata">
<?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'tainacan-blocksy' )) != '' ) : ?>
<h2 class="tainacan-single-item-section" id="tainacan-item-metadata-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'tainacan-blocksy' ) ) ); ?>
</h2>
<?php endif; ?>
<div class="tainacan-item-section__metadata <?php echo get_theme_mod($prefix . '_metadata_list_structure_type', 'metadata-type-1') ?>">
<?php if (has_post_thumbnail() && (get_theme_mod($prefix . '_show_thumbnail', 'no') === 'yes') ): ?>
<div class="tainacan-item-section__metadata-thumbnail">
<h3 class="tainacan-metadata-label"><?php _e( 'Thumbnail', 'tainacan-blocksy' ); ?></h3>
<p class="tainacan-metadata-value"><?php the_post_thumbnail('tainacan-medium-full'); ?></p>
</div>
<?php endif; ?>
<?php do_action( 'tainacan-blocksy-single-item-metadata-begin' ); ?>
<?php
$args = array(
'display_slug_as_class' => true,
'before_title' => '<h3 class="tainacan-metadata-label">',
'after_title' => '</h3>',
'before_value' => '<p class="tainacan-metadata-value">',
'after_value' => '</p>',
'exclude_title' => (get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no')
);
tainacan_the_metadata( $args );
?>
<?php do_action( 'tainacan-blocksy-single-item-metadata-end' ); ?>
</div>
</section>