已安装的favicons - >未定义的变量 - >网站崩溃

时间:2015-07-09 12:59:10

标签: php wordpress

请在判断前阅读

我刚刚制作了网站并将其上传到网站上。当我把它们包括在标题中时,一切都崩溃了。我删除了 W3 Total Cache 插件,因为我知道插件是缓存的。然后一切都消失了。

我打开了WP_DEBUG,目前我收到以下错误:

  

注意:未定义的变量:功能   /customers/a/2/1/domain/httpd.www/wp-content/themes/name/functions.php   第42行

     

注意:未定义的变量:参数   /customers/a/2/1/domain/httpd.www/wp-content/themes/theme/functions.php   第42行

     

警告:无法修改标头信息 - 已发送的标头   (输出始于   /customers/a/2/1/domain/httpd.www/wp-content/themes/theme/functions.php:42)   在/comersomers/a/2/1/domain/httpd.www/wp-includes/pluggable.php   在1196行

请参阅第here

我尝试了以下内容:

  • 更改为另一个Wordpress主题
  • 联系主持人,但他们无法帮助我,因为这个问题是关于wordpress的。
  • 在线搜索建议
  • 删除了header.php中包含favicon的所有更改
  • 删除了所有上传的favicon>

我觉得有趣的是自定义字段插件 Types 已从插件页面消失。我发现这很有趣,因为我记得插件有点难以与之互动。那可能是有什么麻烦吗?

我还看到,在删除favicon后,它们仍会出现在网站上。但是,我目前没有任何缓存。

但我不知道发生了什么。

使用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' );

?>

你能帮我吗?

更新

如果有效的话我感兴趣,所以我去了一个特定的帖子和页面。

Here is a specific article written with Types。事实证明它被重新发送到头版。

Here is the 404 page。哇。这个网站确实有效。

Here is a page。有点工作。但是一个错误显示为标题。否则与索引相同的错误。

可以找到Header.php here

我在这里添加了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

2 个答案:

答案 0 :(得分:2)

不要删除主题试图在其他地方使用的功能。你不能以这种方式解决你的错误。所以,放回你的功能

function custom_theme_setup() {
    add_theme_support( $feature, $arguments );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );

因为现在你因错过上述功能而导致了另一个错误。

<title>标记下添加您的favicon链接。

下面的某个地方
<!-- 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>标签内的都在身体标签之间!显然这是一个huuuge问题。请链接您最新的header.php代码。

编辑2# - 我注意到的一些东西,注意到这里:

  1. <body> <! Avsluttes i footer.php --> - 浏览器无论如何都要修复它,但您最好自己修复评论,<!-- -->

  2. 您是否在functions.php或其他地方将您的脚本入队?您的所有脚本都在控制台上提供304代码。此外,您可以在关闭</body>之前将脚本标记添加到footer.php。 IE浏览器。以下链接

  3. <script src="<?php bloginfo('stylesheet_directory'); ?>/js/svgicons-config.js"></script> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/svgicons.js"></script>

    您还提到您已从其他主题或网站复制了函数等...所有这些主要错误x is undefined等可能是由此引起的。可能你(部分)缺少相关的东西。

答案 1 :(得分:1)

呃...你看过com.nice.controller ??

的第42行了吗?
functions.php

......应该很明显function custom_theme_setup() { add_theme_support( $feature, $arguments ); } 此时未定义。注释掉这一行,错误就会消失,我想......?

相关问题