display text inside and below appointment form

Hello,

I need to display a text below the price line of the appointment form likethat:
Price: 70 GBP
(text here)

I also need to display an image below the appointment form, how can I do that?

Best regards,

  • Michelle Shull

    Hi, Remi!

    We don't have that functionality built in to Appointments+ at this time, so the only way to accomplish this is with edits to the appointments files themselves. We don't recommend changing core files in our plugins as those changes are lost each time the plugin updates.

    If you'd like to move forward with this, the code you need to edit is in appointments.php, which you'll find in wp-content/plugins/appointments. These are the lines which generate the information in the Price field on the confirmation form:

    if ( $price > 0 )
    			$price = '<label><span>'.__('Price: ', 'appointments' ).  '</span>'. apply_filters( 'app_confirmation_price', $price . " " . $display_currency, $price ) . '</label>';
    		else
    			$price = 0;

    And this is the complete form code, to determine where you'd like to insert an image.

    $service_obj = $this->get_service( $service );
    		$service = '<label><span>'. __('Service name: ', 'appointments' ).  '</span>'. apply_filters( 'app_confirmation_service', stripslashes( $service_obj->name ), $service_obj->name ) . '</label>';
    		$start = '<label><span>'.__('Date and time: ', 'appointments' ). '</span>'. apply_filters( 'app_confirmation_start', date_i18n( $this->datetime_format, $start ), $start ) . '</label>';
    		$end = '<label><span>'.__('Lasts (approx): ', 'appointments' ). '</span>'. apply_filters( 'app_confirmation_lasts', $service_obj->duration . " ". __('minutes', 'appointments'), $service_obj->duration ) . '</label>';
    		if ( $price > 0 )
    			$price = '<label><span>'.__('Price: ', 'appointments' ).  '</span>'. apply_filters( 'app_confirmation_price', $price . " " . $display_currency, $price ) . '</label>';
    		else
    			$price = 0;
    
    		if ( $worker )
    			$worker = '<label><span>'. __('Service provider: ', 'appointments' ).  '</span>'. apply_filters( 'app_confirmation_worker', stripslashes( $this->get_worker_name( $worker ) ), $worker ) . '</label>';
    		else
    			$worker = '';
    
    		if ( $this->options["ask_name"] )
    			$ask_name = "ask";
    		else
    			$ask_name = "";
    
    		if ( $this->options["ask_email"] )
    			$ask_email = "ask";
    		else
    			$ask_email = "";
    
    		if ( $this->options["ask_phone"] )
    			$ask_phone = "ask";
    		else
    			$ask_phone = "";
    
    		if ( $this->options["ask_address"] )
    			$ask_address = "ask";
    		else
    			$ask_address = "";
    
    		if ( $this->options["ask_city"] )
    			$ask_city = "ask";
    		else
    			$ask_city = "";
    
    		if ( $this->options["ask_note"] )
    			$ask_note = "ask";
    		else
    			$ask_note = "";
    
    		if ( isset( $this->options["gcal"] ) && 'yes' == $this->options["gcal"] )
    			$ask_gcal = "ask";
    		else
    			$ask_gcal = "";
    
    		$reply_array = array(
    							'service'	=> $service,
    							'worker'	=> $worker,
    							'start'		=> $start,
    							'end'		=> $end,
    							'price'		=> $price,
    							'name'		=> $ask_name,
    							'email'		=> $ask_email,
    							'phone'		=> $ask_phone,
    							'address'	=> $ask_address,
    							'city'		=> $ask_city,
    							'note'		=> $ask_note,
    							'gcal'		=> $ask_gcal
    						);
    
    		$reply_array = apply_filters( 'app_pre_confirmation_reply', $reply_array );
    
    		die( json_encode( $reply_array ));
    	}

    If working with PHP code is a bit above your head, I'd recommend working with an experienced PHP/WordPress developer to customize this form for you.

    Thanks for your question!

  • Jude

    Hi there @Remi

    Here are possible solutions to your issues.

    I need to display a text below the price line of the appointment form likethat:
    Price: 70 GBP
    (text here)

    Michelle's fix will work beautifully except that you may need to do it after each update. Here is an alternative approach to your problem

    Just put your text and replace below

    add_filter('app_confirmation_price', 'display_extras');
    function display_extras($price)
    {
    	return $price . '<br> <br>  <b> Put some TEXT or HTML here </b> <br>' 	;
    }

    Just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.

    I managed to modify the text inside but where do I put the code to have an image outside of the booking form (below the appointment form)?

    Here is some code that can do this for you

    add_action('wp_footer', 'display_image');
    function display_image()
    {
    	$image = '<img src=\"https://www.google.co.in/images/srpr/logo11w.png\">' ;
    	echo  '<script>jQuery(".appointments-confirmation-wrapper").append("'.$image.'") ; </script>'	;
    }

    Put your image in the place of the Google logo. pay attention to the "\". Its an escape character.

    Once again just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.