Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter mbri

    (@mbri)

    Hi Patrick thanks a lot, I will give it a try and let you know how it went.
    Cheers

    Thread Starter mbri

    (@mbri)

    Hi I have copied your code on my functions.php file, I have edit it as following to add a icon:

    // Only show Phone Number if not empty.
    function em_customplaceholder_show_phone($replacement, $EM_Booking, $result) {
    	global $EM_Event;
    	if( $result == '#_ccShowPhone' ) {
    		$show_phone = $EM_Booking->output('#_BOOKINGPHONE');
    		if( !empty($show_phone) ) {
    			$replacement = '<i class="material-icons phone-klant-ico">'.'contact_phone'.'</i>'.'Phone Number: '.$show_phone.'<br/>';
    		}
    		else {
    			$replacement = '';
    		}
    	}
    	return $replacement;
    }
    add_filter('em_booking_output_placeholder', 'em_customplaceholder_show_phone', 1, 3 );
    

    The icon and the text: ‘Phone Number:’ are not showing, the phone number is showing. what am I doing wrong?

    Also I am trying to do the same for the comments, so I have adjusted your code as follows:

    // Only show Comments in bookings if not empty.
    function em_customplaceholder_show_comm($replacement, $EM_Booking, $result) {
    	global $EM_Event;
    	if( $result == '#_ccShowComm' ) {
    		$show_comm = $EM_Booking->output('#_BOOKINGCOMM');
    		if( !empty($show_css) ) {
    			$replacement = '<i class="material-icons phone-klant-ico">'.'info'.'</i>'.'Extra info: '.$show_phone.'<br/>';
    		}
    		else {
    			$replacement = '';
    		}
    	}
    	return $replacement;
    }
    add_filter('em_booking_output_placeholder', 'em_customplaceholder_show_comm', 1, 3 );

    Also here what am I missing? Thanks!

    • This reply was modified 5 years, 10 months ago by mbri.
    • This reply was modified 5 years, 10 months ago by mbri.

    1) You are using the new placeholders, right? #_ccShowPhone and not #_BOOKINGPHONE.

    2) #_BOOKINGCOMM is not a valid placeholder! https://wp-events-plugin.com/documentation/placeholders/

    In the second your variables are mixed up as well.

    It looks like your naming of the icons are incorrect (English and Dutch are never mixed). But since that is not EM, you will need to check ik there.

    Thread Starter mbri

    (@mbri)

    Hello thanks with your help I have fixed it, now both are working!

    // Only show Phone Number if not empty.
    function em_customplaceholder_show_phone($replacement, $EM_Booking, $result) {
    	global $EM_Event;
    	if( $result == '#_ccShowPhone' ) {
    		$show_phone = $EM_Booking->output('#_BOOKINGPHONE');
    		if( !empty($show_phone) ) {
    			$replacement = '<i class="material-icons phone-klant-ico">'.'contact_phone'.'</i>'.'Phone Number: '.$show_phone.'<br/>';
    		}
    		else {
    			$replacement = '';
    		}
    	}
    	return $replacement;
    }
    add_filter('em_booking_output_placeholder', 'em_customplaceholder_show_phone', 1, 3 );
    
    // Only show comment on booking if not empty.
    function em_customplaceholder_show_comm($replacementcomm, $EM_Booking, $resultcomm) {
    	global $EM_Event;
    	if( $resultcomm == '#_ccShowComm' ) {
    		$show_comm = $EM_Booking->output('#_BOOKINGCOMMENT');
    		if( !empty($show_comm) ) {
    			$replacementcomm = '<i class="material-icons phone-klant-ico">'.'info'.'</i>'.'Extra info: '.$show_comm.'<br/>';
    		}
    		else {
    			$replacementcomm = '';
    		}
    	}
    	return $replacementcomm;
    }
    add_filter('em_booking_output_placeholder', 'em_customplaceholder_show_comm', 1, 3 );
    
Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Custom bookings views’ is closed to new replies.