• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Making Genesis W3C Valid? Remove unnecessary TYPE attribute from menu JavaScript

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Making Genesis W3C Valid? Remove unnecessary TYPE attribute from menu JavaScript

This topic is: not resolved

Tagged: child themes, html, js, validation

  • This topic has 5 replies, 2 voices, and was last updated 4 years, 6 months ago by Victor Font.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • November 15, 2018 at 5:51 pm #224380
    cbryant
    Member

    When trying to validate a Genesis Child Theme (the Genesis Sample child), the W3C Validator gives this error:

    The type attribute is unnecessary for JavaScript resources.

    There's plenty of help/snippets out there for removing the TYPE attribute from enqueued files. But they don't work on the Genesis Responsive Menu js that gets inserted in the footer.

    Does anyone have any idea how to remove the unnecessary TYPE attribute from this JavaScript resource?

    Thanks.

    November 15, 2018 at 7:21 pm #224384
    Victor Font
    Moderator

    While the script is being loaded by the Genesis Sample theme in functions.php, Genesis is simply executing the WordPress wp_enqueue_script to do so. The type attribute is inserted by WordPress, not Genesis. You're best bet for finding a solutions is to Google and look at the many recommendations out there.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    November 15, 2018 at 7:51 pm #224385
    Victor Font
    Moderator

    I did my own Google search and found some code that works:

    https://pastebin.com/BbiUUwbZ


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    November 20, 2018 at 3:18 am #224467
    cbryant
    Member

    Hi Victor,

    Thank you for responding.
    I apologize for not replying back sooner.
    I think the forum notification went to spam.

    Either way - I'll check out the code you found and reply again.

    Thanks!

    November 22, 2018 at 3:11 am #224517
    cbryant
    Member

    Hi Victor,

    I checked out the code you'd found online.
    I actually already have that code in my theme - and it works great for enqueued js and css.

    However, that code does not remove the TYPE attribute from the Genesis Responsive Menu setup script. That script is used/called (my js ignorance is showing) using wp_localize_script (not enqueue). So my hunch is that has something to do with it.

    I need to move on to other issues for now.
    But I'm determined to validate this Genesis theme.
    So if I get a solution - I'll share here.
    And hopefully, if someone else does, they will too.

    All the best,

    November 24, 2018 at 11:46 am #224571
    Victor Font
    Moderator

    The code I provided for you works for me with the responsive script. I tested it with multiple themes in my local environment and edited it for performance. Code used with wp_localize_script still requires a script to be enqueued. All wp_localize_script does is setup a script for translation. It has nothing to do with enqueuing.

    Also if you look at the sample theme's functions.php. You'll see the responsive script is being enqueued right before wp_localize_script is called.

    https://codex.wordpress.org/Function_Reference/wp_localize_script


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble