function mytheme_enqueue_assets()
{
wp_enqueue_style('my-theme-stylesheet', get_stylesheet_uri());
wp_enqueue_style('my-theme-styles', get_template_directory_uri() . '/assets/css/style.min.css', array(), '1.0');
wp_enqueue_script('jquery');
wp_enqueue_script('my-theme-scripts', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), '1.0', true);
}
add_action('wp_enqueue_scripts', 'mytheme_enqueue_assets');
this is my functions.php
file and whenever I add wp_head()
and wp_footer()
to my template, it renders as HTML text.
this is my header.php
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/style.min.css"> -->
<?php wp_head(); ?>
</head>
<body>
<header>
<div class="header-wrap">
<a class="logo" href="<?php echo home_url(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/logo.png" alt="logo"></a>
<a class="logo mobile" href="<?php echo home_url(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/logo-ico.png" alt="logo"></a>
</div>
</header>
this is what prints in the footer and rendered as text:
/* <![CDATA[ */ var rankMath = {"version":"1.0.244","ajaxurl":"http:\/\/localhost\/new-site\/wp-admin\/admin-ajax.php","adminurl":"http:\/\/localhost\/new-site\/wp-admin\/admin.php","endpoint":"http:\/\/localhost\/new-site\/wp-json\/rankmath\/v1","security":"c046b4b57e","restNonce":"0caa9b3384","modules":{"0":"link-counter","1":"analytics","2":"seo-analysis","3":"sitemap","4":"rich-snippet","10":"content-ai","11":"instant-indexing","12":"local-seo"},"objectID":9,"objectType":"post"}; /* ]]> */
/* <![CDATA[ */ (function() { var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)'); request = true; b[c] = b[c].replace( rcs, ' ' ); // The customizer requires postMessage and CORS (if the site is cross domain). b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs; }()); /* ]]> */
any thoughts to this? can't seem to fix this. thanks in advance.