• I’ve tried to search around for answers, but couldn’t find any. I’d like the formatting on entries to be <br>. I thought the markdown plugin would do that, but I guess I was wrong. Or is it simply that it doesn’t effect old entries? Someone please help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’d like the formatting on entries to be < br >

    Do you mean that you don’t want any < p > tags added?

    Markdown will produce valid HTML code, so it is going to use < p > tags as well.

    Thread Starter marmelade

    (@marmelade)

    Is there a way to remove the tags then? I don’t like < p >

    There is no “check box to remove < p > tags” option in WordPress as the P tag is a vital atribute for valid HTML pages.

    You could write a plugin to disable wpautop() (the function that is formatting your posts) and replace it with nl2br() – a function that will do what you want.

    If you’re not up to that, let me know and I’ll crank it out for you.

    Thread Starter marmelade

    (@marmelade)

    I have no idea of how to do that, so I’ll have to ask you to help me out =)

    Out of curiosity, why don’t you “like” paragraph tags? What is there to like or not like. It’s html?

    Do you just want to be able to start a new line on the next line without the added space between paragraphs? If so, markdown WILL do that for you.

    put this in a file called ‘just-br.php’ and upload it to you plugins directory. activate and be done.


    <?php
    /*
    Plugin Name: Just-BR
    Description: Switch the wpautop to nl2br
    Author: Jeff Minard
    Version: 1.0
    Author URI: https://thecodepro.com/
    */

    remove_filter('the_content', 'wpautop');
    remove_filter('the_excerpt', 'wpautop');
    remove_filter('comment_text', 'wpautop');

    add_filter('the_content', 'nl2br', 1);
    add_filter('the_excerpt', 'nl2br', 1);
    add_filter('comment_text', 'nl2br', 1);
    ?>

    and make sure there are no spaces before or after the <? and ?>

    Thread Starter marmelade

    (@marmelade)

    Thanks for the script, but it didn’t help. I’d like the < p > on the content of the post to go away. It’s no big deal, but it would be nice to have more control over the layout.

    Is there a way to make this apply to custom fields as well as the standard post field?

    Wes

    “I’d like the < p > on the content of the post to go away.”

    I think, as the old saying goes, the solution is to stop wanting that. Seriously, I’m not clear on how removing the < p > would give you more control over the layout. Maybe if you say in more detail what you want the layout to be like, people could suggest ways of styling the < p > to achieve it.

    Another thought that comes to mind is wrapping the whole post in a < div > – markdown knows that < div >’s are legitimate block-level elements, and so shouldn’t wrap the text inside in a < p >. But I can’t think of any reason to prefer a < div > over a < p >.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Markdown’ is closed to new replies.