0

我将 wordpress 移至子域。但是,复制过来后,我意识到我的标题与原始站点不同。

我的 head.php 看起来像这样:

<!doctype html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php wp_title('|', true, 'right'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<?php wp_head(); ?>

<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
<link href='http://fonts.googleapis.com/css?family=Maven+Pro:500,700' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico?v=2">
</head>

新标题如下所示:

<html class="no-js" lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

 <link rel="alternate" type="application/rss+xml" title="example &raquo; about Comments Feed" href="http://example.com/about/feed/" />
    <script type="text/javascript">
        window._wpemojiSettings = {"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/example.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2.9"}};
        !function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))} (window,document,window._wpemojiSettings);
    </script>
    <style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<link rel='stylesheet' id='roots_css-css'      href='http://example.com/wp- content/themes/example/assets/css/main.min.css?' type='text/css' media='all'  />
<link rel="EditURI" type="application/rsd+xml" title="RSD"  href="http://example.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml"  href="http://example.com/wp-includes/wlwmanifest.xml" /> 
<meta name="generator" content="WordPress 4.2.9" />

旧标题如下所示:

<html class="no-js" lang="en-US">
<head><link rel="stylesheet" type="text/css" href="http://example.com/wp-content/cache/minify/000000/M9AvKUrMzEstSk7NydFPLC5OLSnWTy4u1s8FigIA.css" media="all" />

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="alternate" type="application/rss+xml" title="example &raquo; about Comments Feed" href="http://example.com/about/feed/" />

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://example.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://example.com/wp-includes/wlwmanifest.xml" /> 
<meta name="generator" content="WordPress 4.1.12" />

所以我意识到旧代码有

<link rel="stylesheet" type="text/css" href="http://example.com/wp-content/cache/minify/000000/M9AvKUrMzEstSk7NydFPLC5OLSnWTy4u1s8FigIA.css" media="all" />

虽然新的有

<link rel='stylesheet' id='roots_css-css' href='http://example.com/wp- content/themes/example/assets/css/main.min.css?' type='text/css' media='all'  />

当我调试它时,从新的显示:

Replaced JavaScript files:
1. //ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js

但旧的显示:

Replaced CSS files:
1. wp-content/themes/example/assets/css/main.css

Replaced JavaScript files:
1. wp-content/themes/example/assets/custom/modernizr.custom.js
2. //ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js
3. wp-content/themes/example/assets/js/scripts.js

出现错误 404 页面找不到。如果我转到该页面并min从 url 中删除,那么我会找到该文件。

我不确定 minify 是如何工作的,我也不知道如何让它在我克隆的 wordpress 上工作。帮助!我在用W3 Total Cache

PS为什么会有img.emoji?为什么它突然出现在我的克隆版本中?

函数.php

<?php

$roots_includes = array(
  'lib/utils.php',           // Utility functions
  'lib/init.php',            // Initial theme setup and constants
  'lib/wrapper.php',         // Theme wrapper class
  'lib/sidebar.php',         // Sidebar class
  'lib/config.php',          // Configuration
  'lib/activation.php',      // Theme activation
  'lib/titles.php',          // Page titles
  'lib/nav.php',             // Custom nav modifications
  'lib/gallery.php',         // Custom [gallery] modifications
  'lib/scripts.php',         // Scripts and stylesheets
  'lib/extras.php',          // Custom functions
);

foreach ($roots_includes as $file) {
  if (!$filepath = locate_template($file)) {
    trigger_error(sprintf(__('Error locating %s for inclusion', 'roots'), $file), E_USER_ERROR);
  }

  require_once $filepath;
}
unset($file, $filepath);

编辑:添加functions.php 编辑:添加调试信息

4

0 回答 0