Title: do_blocks missing CSS
Last modified: August 3, 2023

---

# do_blocks missing CSS

 *  Resolved [marios88](https://wordpress.org/support/users/partakaw/)
 * (@partakaw)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/do_blocks-missing-css/)
 * Hello, when using ‘do_blocks’ the relevant CSS is not injected.
 * example code in functions.php
 *     ```wp-block-code
       function append2content( $content ) {
                return $content .  do_blocks( '<!-- wp:block {"ref":2168} /-->' );
       }
       add_filter( 'the_content', 'append2content' );
       ```
   
 * Is it possible to get the CSS in order for it to render correctly?

Viewing 1 replies (of 1 total)

 *  Thread Starter [marios88](https://wordpress.org/support/users/partakaw/)
 * (@partakaw)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/do_blocks-missing-css/#post-16947029)
 * This was harder than expected.
 * First create your block as a reusable block, then include it like this in your`
   functions.php`
 * To find the id you want to load the assets from, use a plugin that enables you
   to edit reusable blocks.
   Also, you dont have to use enqueue_scripts() in head,
   it will work in the content, if you display the block conditionally
 *     ```wp-block-code
       add_action ( 'astra_html_before', static function() {
           //polylang get current language code
           $lang = pll_current_language();
           match ($lang) {
               'el' => $loadAssetsFromId = 2005,
               'en' => $loadAssetsFromId = 2006,
           };
           (new UAGB_Post_Assets( $loadAssetsFromId ))->enqueue_scripts();
       },10,0);
   
       add_filter( 'astra_content_after', static function( $content ) {
           echo $content.do_blocks( '<!-- wp:block {"ref":2005} /-->' );
       },10,1);
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘do_blocks missing CSS’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon-256x256.gif?rev
   =3240412)
 * [Spectra Gutenberg Blocks – Website Builder for the Block Editor](https://wordpress.org/plugins/ultimate-addons-for-gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-addons-for-gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [marios88](https://wordpress.org/support/users/partakaw/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/do_blocks-missing-css/#post-16947029)
 * Status: resolved