Fixes usage of do_action for blocksy hero title filters.

This commit is contained in:
mateuswetah 2023-11-24 11:42:22 -03:00
parent 094388ed0f
commit 96b84f1392
4 changed files with 30 additions and 15 deletions

View File

@ -3,7 +3,6 @@
/** /**
* Adds Tainacan repository and term items list to settings on customizer. * Adds Tainacan repository and term items list to settings on customizer.
*/ */
if ( !function_exists('tainacan_blocksy_add_repository_and_terms_items_options_panel') ) { if ( !function_exists('tainacan_blocksy_add_repository_and_terms_items_options_panel') ) {
function tainacan_blocksy_add_repository_and_terms_items_options_panel($options) { 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') ) { if ( !function_exists('tainacan_blocksy_custom_post_types_archive_options') ) {
function tainacan_blocksy_custom_post_types_archive_options( $options, $post_type, $post_type_object ) { 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') ) { if ( !function_exists('tainacan_blocksy_custom_post_types_supported_list') ) {
function tainacan_blocksy_custom_post_types_supported_list( $potential_post_types ) { 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 ); 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') ) { if ( !function_exists('tainacan_blocksy_the_content_for_items') ) {
function tainacan_blocksy_the_content_for_items( $content ) { 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 * New filter from Blocksy 2.0.0 to allow using the page title styles
* in the Repository and Terms items list. * in the Repository and Terms items list.
*/ */
add_filter( function tainacan_blocksy_page_title_styles($prefixes) {
'blocksy:hero:dynamic-styles:prefixes', $prefixes[] = 'tainacan-repository-items_archive';
function ($prefixes) { $prefixes[] = 'tainacan-terms-items_archive';
$prefixes[] = 'tainacan-repository-items_archive'; return $prefixes;
$prefixes[] = 'tainacan-terms-items_archive'; }
return $prefixes; add_filter( 'blocksy:hero:dynamic-styles:prefixes', 'tainacan_blocksy_page_title_styles', 10, 1 );
}
);

View File

@ -134,9 +134,15 @@ foreach ($hero_elements as $index => $single_hero_element) {
); );
} }
ob_start();
do_action('blocksy:hero:title:before'); do_action('blocksy:hero:title:before');
$elements[] = $title; $before_hero_title = ob_get_clean();
ob_start();
do_action('blocksy:hero:title:after'); 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()) { } else if ($single_hero_element['id'] == 'custom_description' && $single_hero_element['enabled'] && get_the_archive_description()) {
$description_class = 'page-description'; $description_class = 'page-description';

View File

@ -76,9 +76,15 @@ foreach ($hero_elements as $index => $single_hero_element) {
); );
} }
ob_start();
do_action('blocksy:hero:title:before'); do_action('blocksy:hero:title:before');
$elements[] = $title; $before_hero_title = ob_get_clean();
ob_start();
do_action('blocksy:hero:title:after'); 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']) { } else if ( isset($single_hero_element['id']) && $single_hero_element['id'] == 'breadcrumbs' && $single_hero_element['enabled']) {
if ( class_exists('Blocksy_Breadcrumbs_Builder') ) if ( class_exists('Blocksy_Breadcrumbs_Builder') )

View File

@ -135,9 +135,15 @@ foreach ($hero_elements as $index => $single_hero_element) {
); );
} }
ob_start();
do_action('blocksy:hero:title:before'); do_action('blocksy:hero:title:before');
$elements[] = $title; $before_hero_title = ob_get_clean();
ob_start();
do_action('blocksy:hero:title:after'); 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()) { } else if ($single_hero_element['id'] == 'custom_description' && $single_hero_element['enabled'] && get_the_archive_description()) {
$description_class = 'page-description'; $description_class = 'page-description';