Hide phone number header (+change mail)

Home Forums WordPress Theme CityBook – Directory & Listing WordPress Theme Hide phone number header (+change mail)

This topic contains 25 replies, has 2 voices, and was last updated by  Aron Verhoeven 21 hours, 18 minutes ago.

Viewing 25 posts - 1 through 25 (of 26 total)
  • Author
    Posts
  • #31944

    Aron Verhoeven
    Participant

    Supported

    Hi Support,

    I would like to hide the phone number in the header of an listing. However, it’s seems like it is een LI in the CSS, and I can’t reach any CSS to ‘display: none‘ it. Otherwise, I remove all of the Author Contacts in the header. See: https://prnt.sc/ng2ko8.

    Also, I would like to change the mail in the header, to the website of the listing.

    Is this possible, or do I have to find it in the PHP? If yes, which directory?

    Thanks in advance.

    Kind Regards,
    Aron Verhoeven

    #31966

    CTHthemes
    Keymaster

    You can use this css selector

    
    .list-single-header-contacts li:nth-child(2) {
       display: none;
    }
    

    Or using template override feature: http://prntscr.com/ngjrp4

    https://docs.cththemes.com/docs/advance-features/override-citybook-add-ons-templates/

    #31979

    Aron Verhoeven
    Participant

    Supported

    Thanks, it worked. For people who would like to know:

    The endresult: https://prnt.sc/ngoom0

    Used the following code to hide phone and mail:

    (for hiding phone)

    .list-single-header-contacts li:nth-child(1) {
       display: none;
    }

    (for hiding mail)

    .list-single-header-contacts li:nth-child(3) {
       display: none;
    }

    To insert website url, I used the following code, in listing-contact.php:

    <?php if($website):?>
    <li><span><?php _e( '<i class="fa fa-globe"></i>', 'citybook-add-ons' );?></span> <a href="<?php echo esc_url( $website ) ;?>" target="_blank"><?php echo esc_html( $website ) ;?></a></li>
    <?php endif;?>

    see: https://prnt.sc/ngorkk

    Be sure, it is placed in your childtheme. Otherwise it will be deleted in an next update.

    #32035

    CTHthemes
    Keymaster

    You are right 🙂

    #32354

    Aron Verhoeven
    Participant

    Supported

    It seems it itsn’t working anymore?! Any fix on this?

    Thanks in advance.

    Aron Verhoeven

    #32358

    Aron Verhoeven
    Participant

    Supported

    And when an contact detail is not filled in, for example the phonenumber, the code:

    #widget-contacts-1 .list-author-widget-contacts li:nth-child(2) {
    	display: none;
    }
    #widget-contacts-1 .list-author-widget-contacts li:nth-child(3) {
    	display: none;
    }
    

    is of course reffering to the next contact listing, so that means the incorrect contact detail is hiding.

    For example: as you can see on page http://www.marktadvisor.nl/markt/lapjesmarkt-utrecht/ (https://prnt.sc/nl95cf
    ), I have 2 Contact Widgets. Each of them are visible for different groups, because I don’t wont some groups to show phone and mail.

    However, when the client doesn’t fill in an contact field (adres, mail, phone or website) the order of the CSS script as shown above is not affecting to the right contacct detail.

    I hope u get me 😉

    Any fix on this? I can’t set the phone, website and mail as required. That would fix the problem, but I don’t want to set that as required. So I am seraching for another solution. Thanks in advance.

    Kind Regards,
    Aron Verhoeven

    #32383

    CTHthemes
    Keymaster

    You can override template with class attribute: http://prntscr.com/nlfkcl
    Then hide phone with

    
    .list-contact-phone {
       display: none;
    }
    
    #32428

    Aron Verhoeven
    Participant

    Supported

    Thanks, it worked! Did the same in the azp_widget_contacts.php, which made me able to did the same for the widget contact.

    Thanks! 🙂

    #32448

    Aron Verhoeven
    Participant

    Supported

    Mm.. still having some issues with hiding the widgets for user roles.

    When an user registers via the login/register-form, he will receive an user role automatic: Listing Author.

    However, he doesn’t have buyed an package yet. So the widget, with the restrictions, can’t know if the widget should be visible or not visible, because it is not possible to hide the widget on an specific user role. Only for an package. See: https://prnt.sc/nm1kzr

    Any fix on this? Is there an way to accomplish this? Thanks in advance.

    Kind Regards,
    Aron Verhoeven

    #32469

    Aron Verhoeven
    Participant

    Supported

    Or is there an way I can arrange this with some code? I’ve made an ID class for the widget, could there be an way to insert some code an hide the widget for user roles?

    #32491

    CTHthemes
    Keymaster

    It’s currently not possible to hide widget on user roles.

    And you can change new user default role from Settings -> General screen: http://prntscr.com/nms70p

    #32567

    Aron Verhoeven
    Participant

    Supported

    Okay, thanks for reply.

    Is it then possible to hide some contact info’s (ex. Phone, Mail, Website or Adres) for specific groups?

    Now it is only possible to change the whole Contact Widget.

    Any CSS which I can use to hide some contact info for an specific listing type?

    #32575

    CTHthemes
    Keymaster

    You can override the widget element template to use role on contact infos instead of widget

    #32578

    Aron Verhoeven
    Participant

    Supported

    Mm how should I do this?

    #32580

    CTHthemes
    Keymaster

    Try using the code bellow. Apply hide_contacts_on_check condition on info you would like to hide: http://prntscr.com/nobdsn

    
    <?php
    /* add_ons_php */
    
    //$azp_attrs,$azp_content,$azp_element
    $azp_mID = $el_id = $el_class = $images_to_show = $hide_widget_on = $hide_contacts_on = '';
    
    // var_dump($azp_attrs);
    extract($azp_attrs);
    
    $classes = array(
    	'azp_element',
        'azp_widget_contacts',
        'azp-element-' . $azp_mID,  
        $el_class,
    );
    
    $classes = preg_replace( '/\s+/', ' ', implode( ' ', array_filter( $classes ) ) ); 
    
    if($el_id!=''){
        $el_id = 'id="'.$el_id.'"';
    }
    
    $address = get_post_meta( get_the_ID(), '_cth_contact_infos_address', true );
    $latitude = get_post_meta( get_the_ID(), '_cth_contact_infos_latitude', true );
    $longitude = get_post_meta( get_the_ID(), '_cth_contact_infos_longitude', true );
    $phone = get_post_meta( get_the_ID(), '_cth_contact_infos_phone', true );
    $email = get_post_meta( get_the_ID(), '_cth_contact_infos_email', true );
    $website = get_post_meta( get_the_ID(), '_cth_contact_infos_website', true );
    // $listing_author_id = get_the_author_meta('ID');
    if(( $hide_widget_on_check = citybook_addons_is_hide_on_plans($hide_widget_on) ) !== 'true') :
    
        $hide_contacts_on_check = citybook_addons_is_hide_on_plans($hide_contacts_on);
    ?>
    <div class="<?php echo $classes; ?> authplan-hide-<?php echo $hide_widget_on_check;?>" <?php echo $el_id;?>>
        <div class="for-hide-on-author"></div>
    	
    			<div class="box-widget-item fl-wrap authplan-hide-<?php echo $hide_contacts_on_check;?>" id="listing-contacts-widget">
                    <div class="box-widget-item-header">
                        <h3><?php esc_html_e( 'Location / Contacts : ', 'citybook-add-ons' );?></h3>
                    </div>
                    <div class="box-widget">
                        <div class="contacts-boxes">
                            <div class="contacts-info-box">
                                <?php
                                if($latitude != '' && $longitude != '') : 
                                    $dataArr = array();
                                ?>
                                <div class="map-container">
                                    <?php if(citybook_addons_get_option('use_osm_map') == 'yes'): ?>
                                    <div id="<?php echo uniqid('singleMapOSM'); ?>" class="singleMapOSM" data-lat="<?php echo esc_attr( $latitude );?>" data-lng="<?php echo esc_attr( $longitude );?>" data-loc="<?php echo esc_attr( $address );?>" data-zoom="<?php echo citybook_addons_get_option('gmap_single_zoom');?>"></div>
                                    <?php else: ?>
                                    <div class="singleMap" data-lat="<?php echo esc_attr( $latitude );?>" data-lng="<?php echo esc_attr( $longitude );?>" data-loc="<?php echo esc_attr( $address );?>" data-zoom="<?php echo citybook_addons_get_option('gmap_single_zoom');?>"></div>
                                    <?php endif; ?>
    
                                    
                                </div>
                                <?php 
                                endif; 
                                ?>
                                <div class="box-widget-content">
                                    <div class="list-author-widget-contacts list-item-widget-contacts">
                                        <ul>
                                            <?php
                                            if($address != '' && $longitude != '' && $latitude != '' && $hide_contacts_on_check !== 'true'): ?>
                                            <li><span><?php _e( '<i class="fa fa-map-marker"></i> Address :', 'citybook-add-ons' );?></span> <a href="https://www.google.com/maps/search/?api=1&query=<?php echo $latitude.','.$longitude;?>" target="_blank"><?php echo esc_attr( $address );?></a></li>
                                            <?php endif;?>
                                        
                                            <?php 
                                            if($phone && $hide_contacts_on_check !== 'true'): ?>
                                            <li><span><?php _e( '<i class="fa fa-phone"></i> Phone :', 'citybook-add-ons' );?></span> <a href="tel:<?php echo esc_html( $phone );?>"><?php echo esc_html( $phone ) ;?></a></li>
                                            <?php endif;?>
                                            <?php 
                                            if($email && $hide_contacts_on_check !== 'true'): ?>
                                            <li><span><?php _e( '<i class="fa fa-envelope-o"></i> Mail :', 'citybook-add-ons' );?></span> <a href="mailto:<?php echo esc_html( $email ) ;?>"><?php echo esc_html( $email ) ;?></a></li>
                                            <?php endif;?>
                                            <?php 
                                            if($website && $hide_contacts_on_check !== 'true'): ?>
                                            <li><span><?php _e( '<i class="fa fa-globe"></i> Website :', 'citybook-add-ons' );?></span> <a href="<?php echo esc_url( $website ) ;?>" target="_blank"><?php echo esc_html( $website ) ;?></a></li>
                                            <?php endif;?>
                                        </ul>
                                    </div>
                                    
                                    <?php 
                                    $socials = get_post_meta( get_the_ID(), '_cth_socials', true );
                                    if(is_array($socials) && count($socials)) : ?>
                                    <div class="list-widget-social">
                                        <ul>
                                            <?php 
                                            foreach ($socials as $social) {
                                                echo '<li><a href="'.esc_url( $social['url'] ).'" target="_blank" ><i class="fa fa-'.esc_attr( $social['name'] ).'"></i></a></li>';
                                            }
                                            ?>
                                        </ul>
                                    </div>
                                    <?php 
                                    endif;?>
                                <?php //endif; ?>
                                </div>
                            </div>
                        </div>
                        <!-- End .contacts-boxes -->
                    </div>
                </div>
    
    </div>
    <?php endif; 
    
    
    #32581

    Aron Verhoeven
    Participant

    Supported

    Mm.. I had imported the code above. What should be the next step? How can I add restrictions for different classes in the Contact Widget to be visibile or unvisible?

    #32620

    CTHthemes
    Keymaster

    You can add or remove the conditional check on contact infos to make it hide/visible based on Hide Contacts On setting: http://prntscr.com/np6igg

    #32632

    Aron Verhoeven
    Participant

    Supported

    Thanks! But is it than possible to hide specific fields? For example phone field for a group? Or mail?

    #32635

    Aron Verhoeven
    Participant

    Supported

    Mmm.. seems there is an problem with hiding the specific contact details for specific packages.

    I would love to have the next setup: https://imgur.com/a/odRF87j. So every contact detail is visibile for everyone, except the mailadres and phone. They’re only visible for one specific packages (so called: standhouders).

    So in my overruled azp_widget_contacts.php I’ve setup the next for phone and mail: https://imgur.com/a/4Y8HvQv

    I’ve set-up in the Widget Contact the following: https://imgur.com/a/B6xJuNM. So it should only be visibile for that one specific packages, called ‘Standhouders’.

    For logged-out users, it is working: only address and website are visible. However, when I log in as an test-user with the corresponding listing type for the widget I created, the whole contact widget is visible..

    Can you spot the mistake? Thanks in advance.

    Kind Regards,
    Aron Verhoeven

    #32642

    Aron Verhoeven
    Participant

    Supported
    This reply has been marked as private.
    #32695

    Aron Verhoeven
    Participant

    Supported

    Any fix on this? 🙂

    #32813

    Aron Verhoeven
    Participant

    Supported

    ?

    #32825

    CTHthemes
    Keymaster

    Hello, it because the options is author plan ( which mean apply to author who submit the listing ) not for front end user role.

    #32829

    Aron Verhoeven
    Participant

    Supported

    Ah okay. So it is not possible to hide phone and mail for specific front-end user groups?

    #32848

    CTHthemes
    Keymaster

    I will check to see if it’s possible?

Viewing 25 posts - 1 through 25 (of 26 total)

You must be logged in to reply to this topic.

New featues: CityBook - Listing & Directory WordPress Theme version 2.1.8 was outUpdate now
+