最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

css - Warning: Use of undefined constant all - assumed 'all' (this will throw an Error in a future version of PH

programmeradmin5浏览0评论

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");
发布评论

评论列表(0)

  1. 暂无评论