我正在为我的wordpress网站使用Yootheme模板http://sribasu.com该主题基于Warp Framework构建 . 我的主题的head.php文件在连接bloginfo名称和wp_title()之后打印页面 Headers .
不幸的是,wp_title()函数没有生成任何输出 . 因此,我的所有内页和博客帖页都与主页具有相同的 Headers . 使用此函数时,warp框架是否有任何问题?
我正在使用wordpress 3.6 . 我一直试图搜索谷歌,看看它是否是一个常见的问题 . 但是还没找到合适的解决方案 . 请帮忙 .
编辑:head.php( /yoo_revista_wp/warp/systems/wordpress/layouts/head.php )的代码如下:
<meta charset="<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<?php if($this['config']->get('responsive', false)): ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php endif; ?>
<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
<link rel="shortcut icon" href="<?php echo $this['path']->url('template:favicon.ico');?>" />
<link rel="apple-touch-icon-precomposed" href="<?php echo $this['path']->url('template:apple_touch_icon.png'); ?>" />
<?php
wp_enqueue_script('jquery');
wp_head();
// set body classes
$this['config']->set('body_classes', implode(' ', get_body_class($this['config']->get('body_classes'))));
// get styles and scripts
$styles = $this['asset']->get('css');
$scripts = $this['asset']->get('js');
// compress styles and scripts
if ($compression = $this['config']->get('compression')) {
$options = array();
$filters = array('CSSImportResolver', 'CSSRewriteURL', 'CSSCompressor');
// set options
if ($compression == 3) {
$options['Gzip'] = true;
}
// set filter
if ($compression >= 2 && ($this['useragent']->browser() != 'msie' || version_compare($this['useragent']->version(), '8.0', '>='))) {
$filters[] = 'CSSImageBase64';
}
if ($styles) {
// cache styles and check for remote styles
$styles = array($this['asset']->cache('template.css', $styles, $filters, $options));
foreach ($styles[0] as $style) {
if ($style->getType() == 'File' && !$style->getPath()) {
$styles[] = $style;
}
}
}
if ($scripts) {
// cache scripts and check for remote scripts
$scripts = array($this['asset']->cache('template.js', $scripts, array('JSCompressor'), $options));
foreach ($scripts[0] as $script) {
if ($script->getType() == 'File' && !$script->getPath()) {
$scripts[] = $script;
}
}
}
}
// add styles
if ($styles) {
foreach ($styles as $style) {
if ($url = $style->getUrl()) {
printf("<link rel=\"stylesheet\" href=\"%s\" />\n", $url);
} else {
printf("<style>%s</style>\n", $style->getContent());
}
}
}
// add scripts
if ($scripts) {
foreach ($scripts as $script) {
if ($url = $script->getUrl()) {
printf("<script src=\"%s\"></script>\n", $url);
} else {
printf("<script>%s</script>\n", $script->getContent());
}
}
}
// add feed link
if (strlen($this['config']->get('rss_url',''))) {
printf("<link href=\"%s\" rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS 2.0\" />\n", $this['config']->get('rss_url'));
}
$this->output('head');
2 回答
我必须承认,从本的反应中得到了很好的线索 . 最后确定了罪魁祸首插件 - 它是Contus Video Gallery . 该插件很好用,但篡改了我的页面 Headers :X
我在 /plugins/contus-video-gallery/hdflvvideoshare.php 的Contus Video Gallery插件中修复了wp_title过滤器功能,它就像一个魅力!
以前的代码是:
现在代码是:
来自codex:
测试代码:
第一个参数$ sep:在帖子 Headers (即分隔符)之前或之后(由$ seplocation指定)显示的文本 . 默认值:»(»)