CM42
CM42

Reputation: 11

PHP file : how to start a new line

I am a complete beginner to programming and would like to have your help to be able to do a newline on a PHP file.

Here is the text as it appears in the email sent to the customers through Wordpress :

Voici le récapitulatif de votre commande effectuée sur XXX. Veuillez procéder au règlement de la facture via ce lien sécurisé : Payer pour cette commande - Pay for this order. Here is the summary of your order made on XXX. Please proceed to the payment of the invoice via this secure link: Payer pour cette commande - Pay for this order

I would like a line break within the French and English text as follows:

Voici le récapitulatif de votre commande effectuée sur XXX. Veuillez procéder au règlement de la facture via ce lien sécurisé : Payer pour cette commande - Pay for this order

Here is the summary of your order made on XXX. Please proceed to the payment of the invoice via this secure link: Payer pour cette commande - Pay for this order

I tried to use \ n "\ n" or even r \ n \ within the two texts but it doesn't work.

Here is the code :

<?php if ( $order->needs_payment() ) { ?>
 <p>
 <?php
 printf(
 wp_kses(
  /* translators: %1$s Site title, %2$s Order pay link */
  __( 'Voici le récapitulatif de votre commande effectuée sur %1$s. Veuillez procéder au règlement de la facture via ce lien sécurisé: %2$s Here is the summary of your order made on %1$s. Please proceed to the payment of the invoice via this secure link: %2$s', 'woocommerce' ),
  array(
  'a' => array(
   'href' => array(),
  ),
  )
 ),
 esc_html( get_bloginfo( 'name', 'display' ) ),
 '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Payer pour cette commande - Pay for this order', 'woocommerce' ) . '</a>'
 );
 ?>
 </p>

If anyone had a tip for a newline within the two texts, that would be great.

Thanks in advance for your time.

CM

Upvotes: 1

Views: 74

Answers (1)

Ivan
Ivan

Reputation: 1304

Simply insert a line break within your current text right after the "Pay for this order" part, as follows:

'...Pay for this order<br>';

Want to a new line and a blank one as well? Then insert two line breaks, as follows:

'...Pay for this order<br><br>';

You can achieve the same thing by inserting the line breaks at the beginning of the next line. If you decide to go about it this way, you'll need to send the e-mail as HTML.

Upvotes: 1

Related Questions