Forum

How remove type=&qu...
 
Notifications
Clear all

How remove type="text/javascript" in Osclass

2 Posts
2 Users
0 Likes
364 Views
(@adrianolmedo)
Posts: 48
Member
Topic starter
 

Remove type="text/javascript" from osc_enqueue_script() function.

For the html5 validation in our sites the attribute 'type' is obsolete  and should not be placed.

We could resolve this editing directly in the file' line:

oc-includes/osclass/classes/Scripts.php#L92.

But, the correct way to do fix this without touch the core osclass (original code) is make it from the template (for me is the best practice).

Open the function.php file of your template and paste this code starting or at the end:

osc_remove_hook('header', 'osc_load_scripts');

function cust_load_scripts() {
    foreach (Scripts::newInstance()->getScripts() as $script) {
        echo '<script src=""'.osc_apply_filter('theme_url'," $script).'"></script>'.PHP_EOL;
    }
}
osc_add_hook('header', 'cust_load_scripts');
 
Posted : 20/01/2020 2:25 am
(@rusnam)
Posts: 219
Estimable Member
 

Thanks!

 
Posted : 21/01/2020 6:21 am
Share: