Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

P tag is not displayed in html editor (TinyMCE) for WordPress

I am developing site with WordPress and I'm newbie for WordPress. WP adds <p> tag in editor while adding any post or pages. But I can't see the <p> tag in HTML mode.
Can anyone suggest me what might be the problem?

Thanks in advance

like image 561
user75472 Avatar asked Mar 24 '10 04:03

user75472


3 Answers

Try adding the following line just before the_content() tag in your template:

<?php remove_filter ('the_content', 'wpautop'); ?>

Source

like image 101
markd Avatar answered Oct 06 '22 12:10

markd


It's not difficult to do this. To display the p and br tag we just need to install plugin which is "tinymce-advanced" and do some setting change. To change the setting just click check box for "Stop removing the p and br tags when saving and show them in HTML editor" and save. Now we can see the p and br tags in HTML mode.

:)

like image 26
user75472 Avatar answered Oct 06 '22 14:10

user75472


When you retrieve the stored data from the database, you need to run a filter on it to add the p and br tags back in. This is how wordpress handles content. When you use the_content(), for example, it is already running a filter on it, so when you have a custom loop, you may need to run the filter manually.

<?php echo apply_filters('the_content', $your_retrieved_data); ?>

reference: http://codex.wordpress.org/Function_Reference/apply_filters

You definitely don't need a plugin, and I would recommend not using the method described by user75472. Your data won't be as clean and future-proof.

like image 20
Jake Avatar answered Oct 06 '22 13:10

Jake