如何使用PHP在li标记之前添加span标记?
我正在使用WordPress中的插件。我想在如何使用PHP在li标记之前添加span标记?,php,wordpress,list,html-lists,html,Php,Wordpress,List,Html Lists,Html,我正在使用WordPress中的插件。我想在之后添加,因为我将在span中添加一个bg图像覆盖。所以它将是这样的: 我正在尝试使用上述WordPress插件的CatListDisplayer.php(第87行),因为我注意到列表循环就是在这里发生的 $this->lcp_output .= '>'; $inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p'; 我尝试添加以下内容: $this->lcp_out
之后添加,因为我将在span中添加一个bg图像覆盖。所以它将是这样的:
我正在尝试使用上述WordPress插件的CatListDisplayer.php(第87行),因为我注意到列表循环就是在这里发生的
$this->lcp_output .= '>';
$inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p';
我尝试添加以下内容:
$this->lcp_output .= '>';
$inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' . 'span' : 'p';
但我得到的是
。我现在一直在尝试不同的组合,但仍然会出现错误。抱歉,我对PHP几乎一无所知。在文件“CatListDisplayer.PHP”中找到私有函数lcp\u build\u post($single,$tag)-第179行,并在该函数中找到以下内容(第187行):
$lcp\u显示\u输出=“”;
并替换为:
$lcp_display_output = '<'. $tag . $class . '>'.(( ($tag == 'ul') || ($tag == 'ol') ) ? '<span></span>' : NULL);
$lcp_display_output=''(($tag==''ul')| |($tag==''ol'))?'':NULL);
享受。;-) 嗨,伊维扬,跨度仍然没有出现,但非常感谢你花时间回答。非常感谢!:-)我的荣幸。我回答了你的问题,但你确定你看到的是代码的正确部分吗?我没有时间检查整个插件。请你翻转所有的PHP文件,如果你看到类似的评论。
$lcp_display_output = '<'. $tag . $class . '>'.(( ($tag == 'ul') || ($tag == 'ol') ) ? '<span></span>' : NULL);