There is a bug in the common.php locate at td-composer/legacy/common/common.php.
If you have more than 1 tdb_single_content shortcode in a page, the css will end up with an extra </style> markup.
The preg_match capture should be use (\X*):
// find inline css
preg_match_all( ‘/\/\* custom css \*\/(\X*)<\/style>/miU’, $rendered_shortcode_content, $style_matches );
…
foreach ( $style_matches[ 0 ] as $style_match ) {
It’s using the first index [ 0 ], that include the </style>
Then
$result_style .= preg_replace( ‘/.tdi_(\X*)/miU’, ‘.td-gutenberg-editor .editor-styles-wrapper .wp-block’, $style_match );
will end up with
“first block of css</style>second block of css</style>”
then
$style = ‘<style>’ . $result_style;
will make it
<style>first block of css</style>second block of css</style>
foreach ( $style_matches[ 0 ] as $style_match ) {
should be
foreach ( $style_matches[ 1 ] as $style_match ) {
and
$style = ‘<style>’ . $result_style;
should be
$style = ‘<style>’ . $result_style . ‘</style>’;
Regards
Might have to change the condition before the loop too.
if ( count( $style_matches ) && is_array( $style_matches[ 0 ] ) ) {
foreach ( $style_matches[ 0 ] as $style_match ) {
// find inline css
$result_style .= preg_replace( ‘/.tdi_(\X*)/miU’, ‘.td-gutenberg-editor .editor-styles-wrapper .wp-block’, $style_match );
}
}
should be
if ( count( $style_matches ) && is_array( $style_matches[ 1 ] ) ) {
foreach ( $style_matches[ 1 ] as $style_match ) {
// find inline css
$result_style .= preg_replace( ‘/.tdi_(\X*)/miU’, ‘.td-gutenberg-editor .editor-styles-wrapper .wp-block’, $style_match );
}
}
-
This reply was modified 4 years by
Frederic Fauvel.
-
This reply was modified 4 years by
Frederic Fauvel.
Hello!
Please make sure you have the latest version of the PHP, WordPress, theme and plugins(11.2). Delete and re-install the TagDiv Composer plugin.
Please check if this code is missing from your htaccess file: https://www.screencast.com/t/iN0R93dD3p from our requirements, make sure you have all the requirements as you can see here: https://forum.tagdiv.com/requirements-for-newspaper/
Thank you!