From 96b84f13928137246532c4cea97d12437e5cfda6 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 24 Nov 2023 11:42:22 -0300 Subject: [PATCH] Fixes usage of do_action for blocksy hero title filters. --- tainacan-blocksy/inc/customizer.php | 21 ++++++++----------- tainacan-blocksy/tainacan/archive-items.php | 8 ++++++- .../tainacan/archive-repository.php | 8 ++++++- .../tainacan/archive-taxonomy.php | 8 ++++++- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/tainacan-blocksy/inc/customizer.php b/tainacan-blocksy/inc/customizer.php index 972e72e..aee73e6 100644 --- a/tainacan-blocksy/inc/customizer.php +++ b/tainacan-blocksy/inc/customizer.php @@ -3,7 +3,6 @@ /** * Adds Tainacan repository and term items list to settings on customizer. */ - if ( !function_exists('tainacan_blocksy_add_repository_and_terms_items_options_panel') ) { function tainacan_blocksy_add_repository_and_terms_items_options_panel($options) { @@ -153,7 +152,7 @@ add_filter( 'blocksy:custom_post_types:single-options', 'tainacan_blocksy_custom /** - * Adds extra customizer options to items single page template + * Adds extra customizer options to items archive template */ if ( !function_exists('tainacan_blocksy_custom_post_types_archive_options') ) { function tainacan_blocksy_custom_post_types_archive_options( $options, $post_type, $post_type_object ) { @@ -221,7 +220,7 @@ add_filter( 'blocksy:custom_post_types:archive-options', 'tainacan_blocksy_custo /** - * Removes tainacan metadatum and filters from the custom metadata options in the customizer controller. + * Removes tainacan metadatum, metadata section and filters from the custom metadata options in the customizer controller. */ if ( !function_exists('tainacan_blocksy_custom_post_types_supported_list') ) { function tainacan_blocksy_custom_post_types_supported_list( $potential_post_types ) { @@ -238,7 +237,7 @@ if ( !function_exists('tainacan_blocksy_custom_post_types_supported_list') ) { add_filter( 'blocksy:custom_post_types:supported_list', 'tainacan_blocksy_custom_post_types_supported_list', 10 ); /** - * Renders the single item page with a custom template that will use most of Blocksy features + * Renders the single item page and single taxonomy with a custom template that will use most of Blocksy features */ if ( !function_exists('tainacan_blocksy_the_content_for_items') ) { function tainacan_blocksy_the_content_for_items( $content ) { @@ -280,11 +279,9 @@ add_filter( 'the_content', 'tainacan_blocksy_the_content_for_items', 11); * New filter from Blocksy 2.0.0 to allow using the page title styles * in the Repository and Terms items list. */ -add_filter( - 'blocksy:hero:dynamic-styles:prefixes', - function ($prefixes) { - $prefixes[] = 'tainacan-repository-items_archive'; - $prefixes[] = 'tainacan-terms-items_archive'; - return $prefixes; - } -); \ No newline at end of file +function tainacan_blocksy_page_title_styles($prefixes) { + $prefixes[] = 'tainacan-repository-items_archive'; + $prefixes[] = 'tainacan-terms-items_archive'; + return $prefixes; +} +add_filter( 'blocksy:hero:dynamic-styles:prefixes', 'tainacan_blocksy_page_title_styles', 10, 1 ); \ No newline at end of file diff --git a/tainacan-blocksy/tainacan/archive-items.php b/tainacan-blocksy/tainacan/archive-items.php index a91435e..c149b77 100644 --- a/tainacan-blocksy/tainacan/archive-items.php +++ b/tainacan-blocksy/tainacan/archive-items.php @@ -134,9 +134,15 @@ foreach ($hero_elements as $index => $single_hero_element) { ); } + ob_start(); do_action('blocksy:hero:title:before'); - $elements[] = $title; + $before_hero_title = ob_get_clean(); + + ob_start(); do_action('blocksy:hero:title:after'); + $after_hero_title = ob_get_clean(); + + $elements[] = $before_hero_title . $title . $after_hero_title; } else if ($single_hero_element['id'] == 'custom_description' && $single_hero_element['enabled'] && get_the_archive_description()) { $description_class = 'page-description'; diff --git a/tainacan-blocksy/tainacan/archive-repository.php b/tainacan-blocksy/tainacan/archive-repository.php index bda2521..9f0a299 100644 --- a/tainacan-blocksy/tainacan/archive-repository.php +++ b/tainacan-blocksy/tainacan/archive-repository.php @@ -76,9 +76,15 @@ foreach ($hero_elements as $index => $single_hero_element) { ); } + ob_start(); do_action('blocksy:hero:title:before'); - $elements[] = $title; + $before_hero_title = ob_get_clean(); + + ob_start(); do_action('blocksy:hero:title:after'); + $after_hero_title = ob_get_clean(); + + $elements[] = $before_hero_title . $title . $after_hero_title; } else if ( isset($single_hero_element['id']) && $single_hero_element['id'] == 'breadcrumbs' && $single_hero_element['enabled']) { if ( class_exists('Blocksy_Breadcrumbs_Builder') ) diff --git a/tainacan-blocksy/tainacan/archive-taxonomy.php b/tainacan-blocksy/tainacan/archive-taxonomy.php index fef414d..8d294fe 100644 --- a/tainacan-blocksy/tainacan/archive-taxonomy.php +++ b/tainacan-blocksy/tainacan/archive-taxonomy.php @@ -135,9 +135,15 @@ foreach ($hero_elements as $index => $single_hero_element) { ); } + ob_start(); do_action('blocksy:hero:title:before'); - $elements[] = $title; + $before_hero_title = ob_get_clean(); + + ob_start(); do_action('blocksy:hero:title:after'); + $after_hero_title = ob_get_clean(); + + $elements[] = $before_hero_title . $title . $after_hero_title; } else if ($single_hero_element['id'] == 'custom_description' && $single_hero_element['enabled'] && get_the_archive_description()) { $description_class = 'page-description';