• Resolved Beatsleigher

    (@beatsleigher)


    Hey there,

    Normally, when I enter text in to the visual editor in the back-end of WP, and hit enter, WordPress generates a paragraph in the HTML editor.

    For some reason, this functionality has gone kaputt.

    For testing purposes, I added a lorem ipsum to one of my pages, to make sure that mCustomScrollbar is working properly; and that is when I noticed, that there are no paragraphs on the webpage.

    You’re more than welcome to see for yourself: https://www.ca-softworks.com/libraries/androidlib/

    In the editor, it is marked up just as it is on the ipsum generator here: https://baconipsum.com/?paras=5&type=all-meat&start-with-lorem=1

    Do I have to activate this feature in my theme, because all other markups work just fine, or is this just some weird bug in WordPress?

    Thanks a lot in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try deactivating all of your plugins to explore whether any could be responsible. If none are, keep all plugins deactivated and switch to the Twenty Fifteen/ Fourteen theme to see whether it could an issue with your theme.

    Thread Starter Beatsleigher

    (@beatsleigher)

    I switched to Twenty Fifteen, and it seems to be an issue with my theme.

    I guess I’ll search around in the page.php and see what I’m doing wrong.

    Thread Starter Beatsleigher

    (@beatsleigher)

    I’ve since solved the problem with the missing paragraphs:

    I created this method, added it to my functions.php and everything’s sorted:

    /**
     * Formats a given post content, so it is displayed properly on the webpage.
     * @param string $post_content
     */
    function formatPost($post_content) {
    	$splitContent = explode(PHP_EOL, $post_content);
    	//echo "<pre >", var_dump($splitContent), "</pre>"; die();
    	for ($i = 0; $i < count($splitContent); $i++)
    		$splitContent[$i] = "<p >" . $splitContent[$i] . "</p>";
    	return implode(PHP_EOL, $splitContent);
    }

    Then just called and echo-d the output; all works fine.
    Thanks for your help, Andrew!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress isn't adding paragraph-tags.’ is closed to new replies.