• Resolved LauraPortugal

    (@lauraportugal)


    Hello,

    I have a (stupid) question.

    In php code I placed some html with PHP echo. (file: description.php)

    like this

    We deliver smartphones <b><?php echo the_content(); ?></b> within one day.

    The output works, but as the content goes in the page, it gives an line break, like this

    We deliver

    REPAIRING

    within one day.

    How to remove the linebreak before and after the <?php echo the_content(); ?>. I like to show it like this

    We deliver REPAIRING within one day.

    Kind regards,

    Laura

    ps I tried also <?php echo esc_html(the_content()); ?> but the same result

    https://wordpress.org/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    the_content is formatted with paragraph tags. Why can’t the other text in in the content?

    You could use $post->post_content instead maybe.

    Thread Starter LauraPortugal

    (@lauraportugal)

    Hi Mike,

    Thank you for your answer and time. Much appreciate.

    It is because I have more then 1000 products, all with the same text, only the item number is changing. So I created a custom file description.php

    a lot of text.......
    We deliver smartphones <b><?php echo the_content(); ?></b> within one day.
    a lot of text
    also we have solution for <b><?php echo the_content(); ?></b>

    So in product description I only have to add a short product name and so on every productpage it is the same.

    But with line break it is very ugly. Your suggestion $post->post_content did not work.

    I hope you can help me. I searched (almost) whole the internet, but can´t find any solution. Is there a way to break a paragraph filter just for the (single product) description field/template?

    Kind regards,
    Laura

    Thread Starter LauraPortugal

    (@lauraportugal)

    Hi

    Sorry, mistake in the code, your suggestion is working!!!!!!!

    Thank a lot. I am very happy.

    Kind regards,
    Laura

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove break line php output’ is closed to new replies.