• Resolved plebster

    (@plebster)


    Hi,

    I am using a pod template to display a hero banner picture for a website I am working on using the block editor. I have the following in my template:

    <span aria-hidden="true" class="wp-block-cover__background has-background-dim-0 has-background-dim"></span>
    </a>
    <img class="wp-block-cover__image-background wp-image-444" alt="" src={@hero_image}; ?> data-object-fit="cover">
    

    When I view the page that calls this template I don’t see anything, however if I was to add a link to the covers css like the:

    <link rel="stylesheet" id="wp-block-cover-css" href="/wp-includes/blocks/cover/style.min.css?ver=6.1.1" media="all">
    

    I see the image as expected. I have noticed this happens for other blocks too, the CSS is ignored or not loaded.

    I feel I am doing something wrong here, what is the correct way to do this?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @plebster

    The WordPress block editor has an autoloader function for block CSS. If you need block markup on other locations than the block editor you’ll have to manually enqueue the block CSS.

    Unfortunately there is nothing we can do about this.

    Cheers, Jory

    Thread Starter plebster

    (@plebster)

    Thanks for that Jory, that is the conclusion that I had come to…

    How do we go about enquing this? do I have to enque every css file into the pods template, are there any examples or documentation that you can show for this.

    Thanks again

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @plebster

    I honestly must say that I’m not sure how to best enqueue this. I know for a fact that some customisations are inline instead of enqueued.

    Since this is WP core and the block editor is still changing quite rapidly I’m not sure how accurate existing documentation would be.
    This is something best asked on the general WordPress forums instead of this Pods specific forum.

    Maybe this could help?
    https://stackoverflow.com/questions/72579216/how-can-i-enqueue-a-css-file-on-a-specific-wordpress-block-template

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pod Templates and Block CSS inclusions’ is closed to new replies.