edit geodir_cf_phone function

This topic contains 11 replies, has 4 voices, and was last updated by  Paolo 6 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #389972

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hello Guys,

    i would like the geodir_cf_phone function to make the “Phone:” disappear. I managed to edit this function via a snippet but it only throws wierd changes.

    The next thing… we got two templates…listing-listview and widget-listing-listview. So now i want them both look exactly the same and i thought i maybe could just replace the template at the point where it gets pulled so i dont need the widget listing listview anymore.

    greetings,
    Falk

    #390056

    Kor
    Moderator
    Post count: 16516

    Hi Falk,

    Are you trying to remove the “Phone:” on the frontend? If you are, have you tried using custom CSS? Also, please tell us a little bit more about the issue you had with the templates. Perhaps some screenshots?

    Thanks!

    #390063

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hey Kor,

    yes thats what im trying… css doesnt work because it will remove my icon aswell…already tried that.

    I added a screenshot… left side is how it should look like ( just deleted the Phone live inside the DOM inspector ) and the right side how it actually look right now.

    
    
    function geodir_cf_phone($html,$location,$cf,$p=''){
     
        // check we have the post value
        if(is_int($p)){$post = geodir_get_post_info($p);}
        else{ global $post;}
     
        if(!is_array($cf) && $cf!=''){
            $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
            if(!$cf){return NULL;}
        }
     
        $html_var = $cf['htmlvar_name'];
     
        // Check if there is a location specific filter.
        if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
            /**
             * Filter the phone html by location.
             *
             * @param string $html The html to filter.
             * @param array $cf The custom field array.
             * @since 1.6.6
             */
            $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
        }
     
        // Check if there is a custom field specific filter.
        if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
            /**
             * Filter the phone html by individual custom field.
             *
             * @param string $html The html to filter.
             * @param string $location The location to output the html.
             * @param array $cf The custom field array.
             * @since 1.6.6
             */
            $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
        }
     
        // Check if there is a custom field key specific filter.
        if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
            /**
             * Filter the phone html by field type key.
             *
             * @param string $html The html to filter.
             * @param string $location The location to output the html.
             * @param array $cf The custom field array.
             * @since 1.6.6
             */
            $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
        }
     
        // If not html then we run the standard output.
        if(empty($html)){
     
            if ($post->{$cf['htmlvar_name']}):
     
                $field_icon = geodir_field_icon_proccess($cf);
                if (strpos($field_icon, 'http') !== false) {
                    $field_icon_af = '';
                } elseif ($field_icon == '') {
                    $field_icon_af = '<i class="fa fa-phone"></i>';
                } else {
                    $field_icon_af = $field_icon;
                    $field_icon = '';
                }
     
     
                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
                        $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
                $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
     
            endif;
     
        }
     
        return $html;
    }

    and i figuered out this line should be responsible for this changes

    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';

    but when i try to edit it… as i said it just gives me back wierd results or even break the whole layout.

    Thanks for your help.

    #390076

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    How about a pure CSS solution?

    
    
    .geodir_more_info.geodir_contact .geodir-i-contact{
        visibility: hidden;
        max-width: 15px;
        display: inline-flex;
    }
    
    .geodir_more_info.geodir_contact .geodir-i-contact i{
        visibility: visible;
    }

    Stiofan

    #390092

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hey Stiofan,

    I tried that in the first place but as I mentioned it will also remove my icon.
    That’s why I’m asking to edit the function and it’s output.

    Greetings Falk

    #390096

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    That should not remove the icon, if you can link me to your site i will check, it might be the case if you are not suing fontawesom icon, i can give you different CSS.

    Stiofan

    #390104

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hey,

    well yeah im using a custom icon for that.

    Here is the related rendered code:

    
    
     <div class="geodir_more_info adress-bg post_address" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">&nbsp;</span><span itemprop="streetAddress" class="adressfix">Berliner Str. 23</span><br><span itemprop="postalCode">53332 </span>
    <span itemprop="addressLocality">Bornheim</span> - <span itemprop="addressNeighbourhood">Roisdorf</span></div>
    <div class="geodir_more_info   geodir_contact" style="clear:both;"><span class="geodir-i-contact" style=" background: url(http://wp.cityconcept-regional.de/wp-content/uploads/2017/04/tel_sign_white.png) no-repeat left center;background-size:18px 18px;padding-left: 21px;">Phone: </span><a href="tel:022223023">02222 - 30 23</a></div>

    My Client doesnt want any third accessing the website right now and its secured by a login.

    I hope you have a solution for this, aswell for my other question about the listing listview template.

    Falk

    #390110

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Try this

    
    
    .geodir_more_info.geodir_contact .geodir-i-contact{
        padding-left: 0;
        color: transparent;
        margin-right: -22px;
    }

    Stiofan

    #390126

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hey,

    thats working… i had to set the margin-right to about -50px but it works…although this work around seems a bit ugly to me 😀

    Anyways thanks for that solution.

    So what about my other issue…should i just try to copy the markup from liisting-listview to widget listing-listview? Or can i just use one of them? Most of the time the system is using listing listview but when i access the search page i get the template from widget listing listview. kind of anoying since thats the only page where i ran into this issue.

    greets
    Falk

    #390129

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    One is used for widgets and one is used for archive pages, what differences are u seeing?

    Stiofan

    #390854

    Falk Meyer-Plate
    Free User
    Post count: 14

    Hey,

    i have now added my styles to the widget listing listview, but i then the widget is limited to the number of listing displayed. I would like to add a ajax call to pull more listings as i did in my listing listview template…we are now using the multilocation addon and when i navigate through the choose city option i get the widget listing listview template and have to press view all in an extra step to get all listing inside that area…i want to bypass that step…thats why i was asking for an option to just replace the whole template.

    greets Falk

    #390893

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    you can’t, the location page is where the session for the location is set.

    If you are using 1 or more premium add-ons you must submit requests in the forum using the account that purchased or support won’t be provided.

    https://wpgeodirectory.com/support-policy/

    Thanks

Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket