Archived topic
Elements - Change color format
3 replies · Started by Alberto on July 10, 2020
Hi.
The intent is to change color format in a chat if the text is between () or <>.
So, I find this piece of code:
<?php
function chatcolor($str) {
$search = [
'#\<(.+?)\>#is',
'#\[(.+?)\]#is',
];
$replace = [
'<span class="color2"><$1></span>',
'<span class="color2"><$1></span>',
];
return preg_replace($search, $replace, $str);
}
?>
So I put in my CSS:
.color2 {
color: #ff0000;
}
And then I create an Element with hook to wp-head, PHP execute, position the page where the chat is .
But it does not function. Where I'm wrong? The code, the css or the Element specs?
Hi there,
I'm not sure where that code is coming from and what is supposed to do.
Have you checked with the code author?
GP doesn't have built-in chat so it must be coming from a plugin?
Hi Leo and thank for response.
The chat comes from Wise Chat Plugin and I ask them for.
The answer was they have no time for that (soooo kind) and I'm trying to make it from myself.
I'm not so strong on coding, so I found that piece of code in another chat file, trying to adapt that on my intent.
If it's possible to reach the goal, it's right.
Otherwise, thanks for support anyway.^^
Unfortunately providing a custom solution like this is out of the scope of this forum.
The questions here should be directly related to GP.
Thanks for your understanding :)