请先阅读后判断
我只是做了favicons并把它们上传到网站上。当我在标题中包含它们时,突然一切都崩溃了。我删除了W3 Total Cache插件,因为我有一个插件缓存的想法。然后一切都消失了。
我打开了WP_DEBUG,目前我得到以下错误:
注意:未定义变量:feature in/客户//2/1/域/httpd.www/wp-content/主题/名称/显然也第42行
注意:未定义变量:参数/客户//2/1/域/httpd.www wp-content/主题/主题/显然也第42行
警告:无法修改报头信息-报头已由(输出开始于/客户//2/1/域/httpd.www/wp-content/主题/主题/显然也:42)在/客户//2/1/域/httpd.www/wp-includes/pluggable.php第1196行
见此处
我已经尝试了如下:
- 更改为另一个Wordpress主题
- 联系了主机,但是他们无法帮助我,因为这个问题是关于wordpress的
- 在线搜索建议
- 删除了header.php中包含favicons的所有更改
- 删除所有上传的图标
我还看到,删除图标后,他们仍然出现在网站上。但是,我现在没有任何缓存。
但除此之外我不知道发生了什么。
使用Filezilla,我看到Type插件在那里。我试图得到一个概述,如果一些文件已被更改,但找不到任何有趣的。
但正如网上的建议所说,我如何使用add_theme_support
有问题,这是正确的吗?也许我完全错了……
这是我的functions.php
<?php
//Isotope
function add_isotope() {
wp_register_script( 'isotope', get_template_directory_uri().'/js/isotope.pkgd.min.js', array('jquery'), true );
wp_register_script( 'isotope-init', get_template_directory_uri().'/js/isotope.js', array('jquery', 'isotope'), true );
wp_enqueue_script('isotope-init');
}
add_action( 'wp_enqueue_scripts', 'add_isotope' );
//Remove "more" jumping
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');
//Remove WordPress Admin bar
add_filter('show_admin_bar', '__return_false');
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'nav-menus' );
}
add_action( 'after_setup_theme', 'mytheme_custom_thumbnail_size' );
function mytheme_custom_thumbnail_size(){
add_image_size( 'frontpage_thumb', 350, 220, array( 'center', 'center' ) ); // Hard crop center
}
function custom_theme_setup() {
add_theme_support( $feature, $arguments );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );
add_action('wp_head', 'my_js_var_stylesheet_directory', 9);
function my_js_var_stylesheet_directory() {
echo '<script type="text/javascript">';
echo 'var stylesheetDir = "' . get_bloginfo('stylesheet_directory') . '"';
echo '</script>';
}
function disable_wp_emojicons() {
// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
// filter to remove TinyMCE emojis
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
}
add_action( 'init', 'disable_wp_emojicons' );
?>
你能帮帮我吗?
我很感兴趣,如果有什么有效的,所以我去了一个特定的帖子和页面。
这是一篇用类型写的文章。结果它被重新放到首页了
这是404页面。哇。
这是一页。有点工作。但有一个错误是显示为标题。
Header.php可以在这里找到
我在这里添加了favicons:
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="apple-touch-icon" sizes="57x57" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="<?php bloginfo('stylesheet_directory'); ?>/img/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/img/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/img/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/img/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/img/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/img/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="<?php bloginfo('stylesheet_directory'); ?>/img/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
<title><?php wp_title( '|', true, 'right' ); ?></title>
最新的header.php可以在这里找到:http://pastebin.com/DCtJ6fMH
不要删除你的主题试图在其他地方使用的函数。你不能用那种方法解决你的错误。因此,放回函数
function custom_theme_setup() {
add_theme_support( $feature, $arguments );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );
因为现在你又有一个错误是由于缺少上面的函数引起的。
在<title>
标签下面添加你的图标链接。
<!-- Normalize CSS --->
<link rel="https://necolas.github.io/normalize.css/3.0.2/normalize.css">
,因为这些链接工作正常。并继续调试,但最好尝试找到确切的问题。让我们从这些问题开始:
1。是否从functions.php中删除了其他代码?如果它之前没有给出这个错误,$feature
和$arguments
在你改变一些东西之前不能被定义。
2。您是否更改了header.php中与favicons相关或无关的任何其他部分?
等待…编辑1# -检查你的html代码现在…所有应该放在<head></head>
标签内的内容都在正文标签之间!显然这是个大问题。请链接最新的header.php代码。
编辑2# -我注意到的一些东西,注意这里:
<body> <! Avsluttes i footer.php -->
-浏览器修复它,但你最好自己修复评论,<!-- -->
你的脚本是否在functions.php或其他地方排队?所有的脚本都在控制台上给出304代码。此外,您可以在关闭
</body>
之前将脚本标记添加到footer.php中。Ie。下面这些链接
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/svgicons-config.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/svgicons.js"></script>
你还提到你从另一个主题或网站复制了功能等…所有这些说x is undefined
等的主要错误都可能是由它引起的。可能你(部分)遗漏了相关的东西。
…你看了functions.php
的第42行吗??
function custom_theme_setup() {
add_theme_support( $feature, $arguments );
}
…很明显,此时$feature
是未定义的。注释掉这行,错误就会消失,我想…?