• Resolved ursulaniamh

    (@ursulaniamh)


    page content is loaded – like this:

    <div >

    <?php $myquery = new WP_Query(‘page_id=33’);?>

    <?php while ($myquery->have_posts()): ?>
    <?php $myquery->the_post();?>

    <div <?php post_class();?> >
    <?php the_content();?>
    </div>

    <?php endwhile;?>

    <?php wp_reset_postdata();?>
    </div>

    Block slugname:
    thegrid

    block files:
    blocks/thegrid/block.php
    blocks/thegrid/block.css

    Everything is fine in the editor but on the live page the CSS does not load at all.
    The block content html and images do load but the css does not

    For now, i paste the whole css block into block.php as a fix….

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ursulaniamh

    (@ursulaniamh)

    BUT , let me say its a great approach to block building, just what Gutenberg needs.

    Thread Starter ursulaniamh

    (@ursulaniamh)

    is this the suggested fix maybe:

    add_action( ‘block_lab_render_template_anchor-block’,
    static function() {
    wp_enqueue_style(
    ‘example-stylesheet-slug’,
    // Path to stylesheet
    );
    }
    );

    Plugin Author Luke Carbis

    (@lukecarbis)

    Hi @ursulaniamh! Yes, you’re right. Since your theme isn’t loading the content in the traditional way (i.e. the template is loading through the loop), Block Lab would require that you enqueue the CSS manually. The action you’ve written out there looks like the right approach.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘block.css not loaded in live page’ is closed to new replies.