Support » Plugin: AMP for WP - Accelerated Mobile Pages » Include custom styles for Gutenberg Block

  • Resolved Petru Vicolas

    (@vicolaspetru)


    Hello, I have a trouble with my block styles that doesn’t loaded in the AMP page. I’m talking about this plugin https://wordpress.org/plugins/recipe-card-blocks-by-wpzoom/. Do you have any hooks that can help me to include my block styles? I have tried with wp_enqueue_scripts but without success đŸ˜”
    There is my code:

    function enqueue_styles_for_AMP() {
                $is_amp_endpoint = function_exists('is_amp_endpoint') && is_amp_endpoint();
                $is_ampforwp_endpoint = function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint();
    
                if ( $is_amp_endpoint || $is_ampforwp_endpoint ) {
    
                    wp_enqueue_style(
                            'my-block-style-css',
                            $this->asset_source( '', 'blocks.style.build.css' ),
                            $this->get_dependencies( 'my-block-style-css' )
                    );
    
                }
            }
    
    add_action( 'wp_enqueue_scripts', 'enqueue_styles_for_AMP' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Include custom styles for Gutenberg Block’ is closed to new replies.