Site logo

Archived topic

Inline dynamic data

18 replies · Started by Gabriel on September 19, 2022

Viewing posts 16–19 of 19

You could also add add-parenthesis the the class list of the Headline Block, and then add the parenthesis manually to the Headline Block itself through this code:

add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
	if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'add-parenthesis' ) !== false ) {
		$content = '(' . $content .')';
	}
	return $content;
}, 10, 3);

Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

Another solution would be to add add-parenthesis to the class list of the Headline Block, and then add this snippet:

add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
	if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'add-parenthesis' ) !== false ) {
		$content = '(' . $content .')';
	}
	return $content;
}, 10, 3);

Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

Thanks for the other workarounds.

You're welcome Gabriel!

This archived topic is closed to new replies.