Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

akhilendra singh
akhilendra singh
2,370 Points

Fatal error: Call to undefined function add_data()

After i added bootstrap js and add_data() in my functions.php, receiving following error;

Fatal error: Call to undefined function add_data()

when i try to open the page in browser, not sure what is missing.

Function file is;

<?php
function themes_styles(){
wp_enqueue_style('bootstrap_css', get_template_directory_uri().'/css/bootstrap/css/bootstrap.min.css');
wp_enqueue_style('main_css', get_template_directory_uri().'/style.css');
}

add_action('wp_enqueue_scripts','themes_styles');

function theme_js(){

    global $wp_scripts;

    wp_register_script('html5_shiv','https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js','','',false);
    wp_register_script('respond_js','https://oss.maxcdn.com/respond/1.4.2/respond.min.js','','',false);

    $wp_scripts<-add_data('html5_shiv', 'conditional', 'lt IE 9');
    $wp_scripts<-add_data('respond_js', 'conditional', 'lt IE 9');
}

add_action('wp_enqueue_scripts','theme_js');
?>

Please help.