Hide seller phone number

Updated on Apr 5, 2016 in [I] ClassifiedEngine
5 on Jul 10, 2014

Is there a way to hide the sellers contact number with a button? so that the user clicks a button then can see the sellers number?

This is to avoid spam

  • Liked by
  • Mo Mo
0 on Oct 23, 2014

Hi The Runner.

to advoid span from bots, i suggest you edit your theme like bellow :

1. Open functions.php then add new function bellow:

if( !function_exists('ce_protect_number') ):
 function ce_protected_number($number){
 $protected_number = $number + 1;
 $digits = str_split($number);
 $html = '<span class="protectedphone">';
 foreach($digits as $digit){
 $html .= '<span>'. $digit .'</span>';
 $html .= '<span>'. rand(0,9) .'</span>';
 }
 return $html;
 }
endif;

2. Open file template.php, go to line 43, replace with line bellow :

<?php if( $seller->et_phone != '' ) echo ce_protected_number($seller->et_phone); else _e("No phone provided.", ET_DOMAIN); ?></span>

3. Open custom.css and add :
.protectedphone span:nth-child(2n){
 display: none;
}

  • Liked by
Cancel
0 on Jan 26, 2015

Hello this does not seem to work for me. here is what I did

Added this into my child theme function.php

<!–?php
if( !function_exists(‘ce_protect_number’) ):
function ce_protected_number($number){
$protected_number = $number + 1;
$digits = str_split($number);
$html = ‘‘;
foreach($digits as $digit){
$html .= ”. $digit .”;
$html .= ”. rand(0,9) .”;
}
return $html;
}
endif;
?>

Then I went onto line 43 of includes/template.php

and replaced this line: it’s line 44 on my php document.

>et_phone != ” )echo $seller->et_phone; else _e(“No phone provided.”, ET_DOMAIN); ?>

with your line above:

And then added the code into my style.css sheet child theme but I just get

Parse error: syntax error, unexpected ‘;’ in /home2/bazoopa/public_html/developer/wp-content/themes/classifiedengine/includes/template.php on line 44

Any ideas what I am doing wrong Nguyễn Văn Được
thanks

  • Liked by
Cancel
0 on Mar 25, 2016

Dear EngineThemes,

This idea has been noted as “STATUS: IMPLEMENTED” but I don’t see this option to my theme, why is that ?

Regards,
Momo

  • Liked by
Cancel
0 on Apr 1, 2016

Dear EngineThemes,

This idea has been noted as “STATUS: IMPLEMENTED” but I don’t see this option to my theme, why is that ?

Regards,
Momo

  • Liked by
Cancel
0 on Apr 5, 2016

Dear EngineThemes,

This idea has been noted as “STATUS: IMPLEMENTED” but I don’t see this option into the theme, why is that ?

Regards,
Momo

  • Liked by
Cancel
Loading more replies
Posting & Replying function will be deactivated from 3pm GMT+7 12th Sep.
Read More