The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

String Replace. (2 posts)

  1. frankfolk
    Posted 4 years ago #


    I am creating a wordpress site for a client and i am experiencing a problem.

    When creating a post from the dashboard pressing enter only creates a line break rather than a paragraph. So it moves it to a new line instead of having a space between the paragraphs.

    So i figure what i have to do is a string replace that finds
    tags and replaces them with <p> tags. The only thing is i actually have no idea how to it haha. So my div i am calling in the content using the <?php the_content(); ?>

    Where do i go from here? I apologize because i don't like creating such an open question but i really don't know where to start with it...

  2. frankfolk
    Posted 4 years ago #

    Right, i have amended someone else's code and i believe this should work.

    function replace_content($content)
    	$content = str_replace('/n', '<p></p>',$content);
    	return $content;

Topic Closed

This topic has been closed to new replies.

About this Topic