themeum / qubely

Qubely Blocks – Full-fledged Gutenberg Toolkit
GNU General Public License v3.0
84 stars 36 forks source link

Missing CSS when importing reusable Qubely block #27

Open adrien-robert opened 4 years ago

adrien-robert commented 4 years ago

Hello,

I'm considering pairing Qubely with Oxygen Builder but I run into an issue since the beginning of my testing of Qubely Pro...

This is what a reusable Qubely block looks like when imported in a Gutenberg page: image

This is what a reusable Qubely block looks like when imported with a shortcode inside Oxygen Builder: image

I have this code inside a Code Snippet to import my reusable gutenberg block (that use Qubely design layout):

add_shortcode('wp_oxy_reusable_block', 'my_reusable_block_sc');
/**
 * Add a shortcode to allow resuable blocks, that are created in WP editor, to be inserted in Oxygen templates using their IDs
 *
 * Sample usage: [wp_oxy_reusable_block id='2543']
 */
function my_reusable_block_sc( $atts ) {

    $attributes = shortcode_atts(
        array(
            'id' => null
        ), $atts );

    $output = do_blocks( get_the_content('', '', get_post($attributes['id']) ) );

    return $output;

}

And then in Oxygen Builder I use the shortcode [wp_oxy_reusable_block id='66'] with 66 as the ID of my reusable block.

How can I import CSS too? What code I need to use or add inside my code snippet?

Thanks.

dovy commented 4 years ago

+1

dovy commented 4 years ago

Found the issue. CSS is stored in a post_meta value called _qubely_css instead of in the template like every other block plugin. This data does not re-render properly. As such, migrations fail.