从Wordpress主题中删除SEO标签

时间:2014-02-25 16:48:32

标签: php wordpress-theming

我在删除php文件中的两行代码时遇到问题。当我删除它们时,我在options.php和post.php上得到一个白色屏幕我认为这是一个简单的代码错误,但我没有成功找出它。我开始的代码是

$this->pagetitle=sprintf($format,$title);
        if ($this->get( 'seo','keywords' )!=''&&$keywords!='')$keywords.=",";
        if ($this->get( 'seo','description' )!=''&&$descr!='')$descr.=" ";
        if (($descrln=200-iconv_strlen($descr, "utf-8"))>=(strpos($this->get( 'seo', 'description' ),' ')))
            $descr.=iconv_substr($this->get( 'seo', 'description' ), 0, $descrln, 'utf-8' );
        if ( $echo ) {
            echo "<title>".sprintf($format,$title)."</title>\r\n";
            echo '<meta name="Description" content="'.preg_replace('/[\'\"]/', '',$descr)."\" />\r\n";
            echo '<meta name="Keywords" content="'.$keywords.$this->get( 'seo', 'keywords' )."\" />\r\n";
        } else {
            return sprintf($format,$title);
        }
    }

}

我要删除的行是

echo '<meta name="Description" content="'.preg_replace('/[\'\"]/', '',$descr)."\" />\r\n";
            echo '<meta name="Keywords" content="'.$keywords.$this->get( 'seo', 'keywords' )."\" />\r\n";

创建问题的结果是

$this->pagetitle=sprintf($format,$title);
        if ($this->get( 'seo','keywords' )!=''&&$keywords!='')$keywords.=",";
        if ($this->get( 'seo','description' )!=''&&$descr!='')$descr.=" ";
        if (($descrln=200-iconv_strlen($descr, "utf-8"))>=(strpos($this->get( 'seo', 'description' ),' ')))
            $descr.=iconv_substr($this->get( 'seo', 'description' ), 0, $descrln, 'utf-8' );
        if ( $echo ) {
            echo "<title>".sprintf($format,$title)."</title>\r\n";
        } else {
            return sprintf($format,$title);
        }
    }

}

0 个答案:

没有答案