[Support request] I need to remove this html line for w3c validator

Home Forums Support I need to remove this html line for w3c validator

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1396655
    limolab

    Hello. as you can see in the title i really need to remove this line:
    <!–googleon: all–><style type=”text/css” media=”screen”></style>

    in source code: line 848.
    i think that this is generate in generate_after_footer part.
    but i really don’t know how to remove it. i really need it for w3c validator
    Can you help me?
    Thanks.
    Limo

    #1396884
    David
    Staff
    Customer Support

    Hi there,

    that is not part of theme. I would expect it has been added Cookie law plugin as it sits between the googleoff and googleon meta tags. You would need to speak to the plugin developer.

    #1397349
    limolab

    Hello, thanks for your quick reply.
    My mistake the line is: 775

    <style type=”text/css” media=”screen”></style>

    Thanks.

    #1397541
    David
    Staff
    Customer Support

    Thats not related to the theme either. Apart from it NOT containing styles i cannot see as an Error in W3C validator.

    #1409150
    limolab

    Hello, i’ve disabled all plugins but the <style> is still there.
    i really don’t know how to hide it.
    I’ve tried with javascript but the w3c still read it.
    —-
    Do you have any advice?
    Thanks.

    #1409204
    David
    Staff
    Customer Support

    Do you have any custom functions or any Hooks containing code ?

    #1409296
    limolab

    yes, i have a custom function.

    ——————————-

    <?php
    /**
    * GeneratePress child theme functions and definitions.
    *
    * Add your custom PHP in this file.
    * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
    */

    function generatepress_child_enqueue_scripts() {
    if ( is_rtl() ) {
    wp_enqueue_style( ‘generatepress-rtl’, trailingslashit( get_template_directory_uri() ) . ‘rtl.css’ );
    }
    }
    add_action( ‘wp_enqueue_scripts’, ‘generatepress_child_enqueue_scripts’, 100 );

    add_action(‘generate_inside_navigation’, ‘db_custom_navigation_search’, 10);
    add_action(‘generate_inside_mobile_header’, ‘db_custom_navigation_search’, 10);
    function db_custom_navigation_search() {
    printf(
    ‘<form method=”get” class=”search-form custom-nav-search” action=”%1$s”>
    <input type=”search” class=”search-field” value=”%2$s” name=”s” title=”%3$s” placeholder=”%3$s”>

    </form>’,
    esc_url( home_url( ‘/’ ) ),
    esc_attr( get_search_query() ),
    esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ ),
    generate_get_svg_icon( ‘search’ )
    ); echo ‘

    ‘;
    }

    /* FUNZIONE PER TOGLIERE IL CUSTOMIZE DEL TEMA */

    add_action( ‘after_setup_theme’, ‘tu_remove_dynamic_css’ );
    function tu_remove_dynamic_css() {
    remove_action( ‘wp_enqueue_scripts’, ‘generate_enqueue_dynamic_css’, 50 );
    }

    /* TOGLI IL TYPE DA SCRIPT E STYLE */

    add_action(
    ‘after_setup_theme’,
    function() {
    add_theme_support( ‘html5’, [ ‘script’, ‘style’ ] );
    }
    );

    #1409340
    David
    Staff
    Customer Support

    Hmmm – i can’t see that would create the empty <style> tag – can you ‘disable’ the childthemes functions.php ( simply remove the code to somewhere safe ) to test.

    #1409348
    limolab

    hello, i have done it, but nothing changed.
    I really don’t know what to do..

    #1409443
    David
    Staff
    Customer Support

    Are you using any Hook Elements ?

    https://docs.generatepress.com/article/hooks-element-overview/
    Check in there to make sure there isn’t any code.

    If not then the only other way to remove it is to look for it in your database.

    Or just ignore it – W3 is only warning you of the use of the styles attribute – not the empty content.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.