Hi, I was trying to replace text in wordpress by adding the following to theme functions functions.php
I was trying to strike off the normal price for hosting packages and include in the offer price.
However, after having done so, nothing changes on my site.
Anybody know what is wrong and how should I do it.
Thanks.
/*-----------------------------------------------------------------------------------*/
/* Promotion */
/*-----------------------------------------------------------------------------------*/
function replace_content_on_the_fly($text){
$replace = array(
// 'words to find' => 'replace with this'
'5.55' => '<strike>5.55</strike>5.00',
'66.60' => '<strike>66.60</strike>60.00',
'8.88' => '<strike>8.88</strike>8.00',
'106.56' => '<strike>106.56</strike>96.00',
'12.99' => '<strike>12.99</strike>11.00',
'155.88' => '<strike>155.88</strike>132.00',
'15.99' => '<strike>15.99</strike>13.00',
'191.88' => '<strike>191.88</strike>156.00',
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'replace_content_on_the_fly');
add_filter('the_excerpt', 'replace_content_on_the_fly');
I was trying to strike off the normal price for hosting packages and include in the offer price.
However, after having done so, nothing changes on my site.
Anybody know what is wrong and how should I do it.
Thanks.
/*-----------------------------------------------------------------------------------*/
/* Promotion */
/*-----------------------------------------------------------------------------------*/
function replace_content_on_the_fly($text){
$replace = array(
// 'words to find' => 'replace with this'
'5.55' => '<strike>5.55</strike>5.00',
'66.60' => '<strike>66.60</strike>60.00',
'8.88' => '<strike>8.88</strike>8.00',
'106.56' => '<strike>106.56</strike>96.00',
'12.99' => '<strike>12.99</strike>11.00',
'155.88' => '<strike>155.88</strike>132.00',
'15.99' => '<strike>15.99</strike>13.00',
'191.88' => '<strike>191.88</strike>156.00',
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'replace_content_on_the_fly');
add_filter('the_excerpt', 'replace_content_on_the_fly');
Comment