diff --git a/tainacan-blocksy/functions.php b/tainacan-blocksy/functions.php index 6cf61a8..b8a3a9e 100644 --- a/tainacan-blocksy/functions.php +++ b/tainacan-blocksy/functions.php @@ -43,8 +43,11 @@ if ( TAINACAN_BLOCKSY_IS_CHILD_THEME || ( TAINACAN_BLOCKSY_IS_BLOCKSY_ACTIVATED if ( !TAINACAN_BLOCKSY_IS_CHILD_THEME ) { /* Disables Tainacan Theme Helper the_content filter, which is used to build a custom item and taxonomy (terms list) template. */ - define('TAINACAN_DISABLE_ITEM_THE_CONTENT_FILTER', true); - define('TAINACAN_DISABLE_TAXONOMY_THE_CONTENT_FILTER', true); + if ( !defined('TAINACAN_DISABLE_ITEM_THE_CONTENT_FILTER') ) + define('TAINACAN_DISABLE_ITEM_THE_CONTENT_FILTER', true); + + if ( !defined('TAINACAN_DISABLE_TAXONOMY_THE_CONTENT_FILTER') ) + define('TAINACAN_DISABLE_TAXONOMY_THE_CONTENT_FILTER', true); require TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/plugin.php'; } diff --git a/tainacan-blocksy/template-parts/tainacan-item-single-metadata_new.php b/tainacan-blocksy/template-parts/tainacan-item-single-metadata_new.php index fdeb5e4..36e8623 100644 --- a/tainacan-blocksy/template-parts/tainacan-item-single-metadata_new.php +++ b/tainacan-blocksy/template-parts/tainacan-item-single-metadata_new.php @@ -10,70 +10,32 @@ in_array($section_layout, ['metadata-section-type-2', 'metadata-section-type-3', 'metadata-section-type-4']) && get_theme_mod($prefix . '_metadata_sections_separate_default_section', 'no') === 'yes'; + /** * The new metadata sections function makes it a bit more complicated to add * the thumbnail in the middle of the metadata. * So we have some logic that is only needed if it is set. - * The following uses a filter to add it right above the first metadatum in the first section. + * The following uses a filter to add it right above the first metadatum in the default section. **/ - if ( has_post_thumbnail() && $show_thumbnail_with_metadata ) { - // Gets collection so we can obtain firtst metadatum - $collection = tainacan_get_collection(); + add_filter('tainacan-get-metadata-section-as-html-before-metadata-list--index-0', function( $before_description, $metadata_section) { + + ob_start(); + ?> +
+

+

+
+ get_metadata_order(); - - if ( is_array($metadata_order) ) { - - $first_metadatum_id = -1; - - foreach( $metadata_order as $metadatum ) { - - // Checks if the metadata is enabled - if ( isset($metadatum['enabled']) && $metadatum['enabled'] && isset($metadatum['id']) ) { - $first_metadatum_id = $metadatum['id']; - - // IF we are not displaying the title here, we must look for the second metadata - if ( $exclude_title_metadata ) { - - $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); - $metadatum_object = $Tainacan_Metadata->fetch($first_metadatum_id); - $metadata_type_object = $metadatum_object->get_metadata_type_object(); - - if ( $metadata_type_object->get_related_mapped_prop() == 'title' ) { - continue; - } - } - - break; - } - } - - if ( is_numeric($first_metadatum_id) && $first_metadatum_id >= 0 ) { - - add_filter('tainacan-get-item-metadatum-as-html-before--id-' . $first_metadatum_id, function($before, $item_metadatum) { - - ob_start(); - ?> -
-

-

-
-