Am new to WordPress theme. I tried writing this little code and got this
Warning: Use of undefined constant all - assumed 'all' (this will throw an Error in a future version of PHP) in C:\Users........ on line 6
Line 6 referring to:
wp_enqueue_style('style', get_stylesheet_uri(), NULL, microtime(), all);
This is the functions.php
code:
<?php
// adding the CSS and JS files
function gt_setup(){
wp_enqueue_style('style', get_stylesheet_uri(), NULL, microtime(), all);
wp_enqueue_script('main', get_theme_file_uri('/js/main.js'), NULL, microtime(), true);
}
add_action('wp_enqueue_scripts', 'gt_setup');
And this is the style.css
code:
body{
background:red;
}
header.php
code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GTCoding</title>
<?php wp_head(); ?>
</head>
<body>
<header>
<h1>Header Here</h1>
</header>
footer.php
code:
<footer>
<p>Footer goes here</p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
JS code:
alert("hi from main.js");