$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>wp enqueue script - wp_head() and wp_footer() rendering as HTML|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp enqueue script - wp_head() and wp_footer() rendering as HTML

matteradmin8PV0评论
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.

Post a comment

comment list (0)

  1. No comments so far