Wordpress Customizr主题添加跨度到导航“a”标签打破网站 [英] Wordpress Customizr theme Adding span to navigation "a" tags breaks site

查看:81
本文介绍了Wordpress Customizr主题添加跨度到导航“a”标签打破网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发布了另外一个关于CSS的问题,但是提出了在导航菜单中为链接标题添加span标签的解决方案。我所拥有的是:

 < div> 
< li>
< a>
关于我
< / a>
< / li>
< / div>

我想要这样的东西:

 < DIV> 
< li>
< a>
< span>
关于我
< / span>
< / a>
< / li>
< / div>

然后我发现我可以尝试使用

  wp_nav_menu(array(
'link_before'=>'< span>',
'link_after'=>'< / span>'

);

继续打破我的网站,导致所有菜单下拉项目只显示在屏幕上我找到的错误是:无法修改标题信息 - 已经发送的标题(输出开始于/ public_html / wp -includes / nav-menu-template.php:256)in /public_html/wp-includes/pluggable.php on line 1210



nav-menu -template.php 256是 echo $ nav_menu;



pluggable.php 1210是标头(Location:$ location,true,$ status);



我很聪明。任何人都知道发生了什么,请帮助。

解决方案

好吧,我终于明白了。



我刚编辑过这个文件:

public_html / wp-includes / nav-menu-template.php $ defaults ,你应该简单地编辑 link_before
link_after


$ defaults = array(... 'link_before'=>'< span>','link_after'=>'< / span>',...);



这应该得到主题,将< span> NAVIGATION LABEL< / span> 加入您的所有导航菜单项。



希望这有助于。


I posted another question about CSS but came to the solution of adding span tags to the title of the links in the navigation menu. What I have is:

<div>
  <li>
    <a>
      About me
    </a>
  </li>
</div>

I wanted something like:

<div>
  <li>
    <a>
      <span>
         About me
      </span>
    </a>
  </li>
</div>

Then I found that I could probably try using

wp_nav_menu( array(
    'link_before' => '<span>',
    'link_after'  => '</span>'
  ) 
);

This proceeded to break my site, causing all menu dropdown items to simply display on screen in addition to the "normal" nav bar I have.

The error I got was: "Cannot modify header information - headers already sent by (output started at /public_html/wp-includes/nav-menu-template.php:256) in /public_html/wp-includes/pluggable.php on line 1210"

nav-menu-template.php 256 is echo $nav_menu;

pluggable.php 1210 is header("Location: $location", true, $status);

I'm at my wits end. Anyone who remotely knows what's going on, please help. Thank you very much in advance!

解决方案

OK guys, I finally got it.

I just edited this file:

public_html/wp-includes/nav-menu-template.php

Within you will see $defaults and you should simply edit link_before and link_after:

$defaults = array( ...'link_before' => '<span>', 'link_after' => '</span>', ...);

This should get the theme to push <span>NAVIGATION LABEL</span> into all your nav menu items.

Hope this helps.

这篇关于Wordpress Customizr主题添加跨度到导航“a”标签打破网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆