Im trying to use ACF (is there a better way?) to change the category name as it appears on the category blocks. For example: subcategory name, Texas red apples, appear on category block as Texas Red Apples, but I just want the name to say Texas (were it links to the category/subcategory).
I already have my custom field on dashboard>listings>categories edit/create new category.
Here is code I have, which doesnt work, but I think im close, if anyone could help. Thank you
add_filter(
'hivepress/v1/templates/Listing_Categories_View_Page',
function( $blocks, $template ) {
if (get_field('custom_anchor_text')) {
$content = get_field('
custom_anchor_text');
return hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'page_content' => [
'blocks' => [
'listing_category_name' => [
'type' => 'content',
'content' => $content,
'_order' => 1,
],
],
],
],
]
)['blocks'];
} // end if
},
1000,
2
);