Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过*符号生成工具提示_Php_Html_Wordpress - Fatal编程技术网

Php 通过*符号生成工具提示

Php 通过*符号生成工具提示,php,html,wordpress,Php,Html,Wordpress,我有以下PHP代码: function word_filter() { $tt_tijdelijke = ''; $tt_gestoffeerd = ''; $tt_gemeubileerd = ''; str_replace('tijdelijke', '<span class="incexc-single" tooltip="'.$tt_tijdelijke.'">tijdelijke</span>'); str_replace('gestoffeerd', '&l

我有以下PHP代码:

function word_filter()
{
$tt_tijdelijke = '';
$tt_gestoffeerd = '';
$tt_gemeubileerd = '';

str_replace('tijdelijke', '<span class="incexc-single" tooltip="'.$tt_tijdelijke.'">tijdelijke</span>');
str_replace('gestoffeerd', '<span class="incexc-single" tooltip="'.$tt_gestoffeerd.'">gestoffeerd</span>');
str_replace('gemeubileerd', '<span class="incexc-single" tooltip="'.$tt_gemeubileerd.'">gemeubileerd</span>');
return true;
}
add_filter('wordfilter','word_filter');
函数字_过滤器()
{
$tt_tijdelijke='';
$tt_gestofferd='';
$tt_gemeubileerd='';
str_replace('tijdelijke','tijdelijke');
str_替换('gestofferd','gestofferd');
str_替换(“gemeubilerd”、“gemeubilerd”);
返回true;
}
添加单词过滤器('wordfilter','wordfilter');
我需要在网站的每一页上运行这个,用同一个单词替换所有单词,但插入一个跨距。这样做将允许在我将鼠标移到单词上时显示工具提示

鼠标盖和工具提示已经起作用了,但我不知道如何让替换在所有页面上都起作用


如何在不造成太多页面负载的情况下最好地调用此函数?

我认为您可以使用javascript split。代码将警告文本,但您可以更改该代码并将其用于工具提示

var txt = 'Word*tooltip';
alert(txt.split("*")[1]);

“一个词”是什么意思?您需要一个JQuery可以识别的元素,如span或div。否则,JQuery将无法应用任何工具提示魔法。@florian。我在互联网上看过如何检测页面上的符号,但我什么也找不到。我如何将其应用于整个页面,而不仅仅是单个字符串?只需创建一个javascript函数。而在mouse-over的元素中,您可以调用它。如果我遗漏了什么,请创建一个JSFIDLE,显示你的确切意思。我已经有了鼠标盖和工具提示,我需要的是用相同的单词替换一个单词,但是在html中,它有工具提示。请创建一个JSFIDLE。如果可以的话,我会的。不过,如果我能设法解决这个问题,我可以做一个。