when i use text editor in WP, i have two options :
<p>
and <br>
tags,I get crazy by that like other millions of people on the web... i would like to work as on a normal html page : when i push "enter", it gives an empty line as we see it on the screen and when we add a code, it gives a the code which behaves like a code.
Now, for example, if i do this in the text :
"this is a sample sentences <h2>here i want two words with h2 style</h2> here my sentence continues...",
in the reality it gives a result like this :
<p>this is a sample sentences <br />
<h2>here i want two words with h2 style</h2><br />
here my sentence continues...</p>
I understood and i tried to remove automatisation with adding remove_filter ('the_content', 'wpautop');
to the functions file but in this case at each line break i must add a code which is crazy.
Is there a solution ???
remove_filter('the_content','wpautop');
//decide when you want to apply the auto paragraph
add_filter('the_content','my_custom_formatting_function');
function my_custom_formatting_function($content){
if(get_post_type()=='YOUR_POSTYPE_NAME') //if it does not work, you may want to pass the current post object to get_post_type
return $content;//no autop
else
return wpautop($content);
}
Would you please add above code in your functions.php
. I hope this is helpful for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With