Archived topic
Widget Title Code
7 replies · Started by Bernhard on September 29, 2022
Hi there,
I have a problem with Advanced Ads as it still uses the classic editor. They have a way to insert code but I have a problem with the GB headline block.
Time ago I got the following to make Advanced Ads working with GB CSS but it seems not to work with the headline block:
add_filter( 'generateblocks_do_content', function( $content ) {
$post_ids = array( 42332, 42333 ); // A post ID to check the content of. Can be dynamically set.
foreach ( $post_ids as $post_id ) {
if ( has_blocks( $post_id ) ) {
$block_element = get_post( $post_id );
if ( ! $block_element || 'advanced_ads' !== $block_element->post_type ) {
return $content;
}
if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
return $content;
}
$content .= $block_element->post_content;
}
}
return $content;
} );
Basically, as a workaround, I want to use the formatting of the widget title, but I don't know, how to address it (like H?).

Can you try adding an additional CSS class widget-title to the headline block?
Hi Ying,
yess, it works :)
It seems that I don't need the above filter in this case. The only thing would be to have a CSS class to center the title and the image.
Thank you.
You are welcome :)
OK, only about the CSS Class to center image and title. Is there a CSS class in the theme or shall I define it by my own?
Hi Bernhard,
Try adding this CSS in Appearance > Customize > Additional CSS:
aside .touri-target > * {
text-align: center;
}
Thank you :)
You're welcome Bernhard!