WordPress.org

Ready to get started?Download WordPress

Forums

HTML linebreaks (<BR> tags) in author/user bio section not working (20 posts)

  1. Kevin Kwok
    Member
    Posted 4 years ago #

    Hello I have author pages showing on my blog that shows posts by that author, their name, their link, and bio.

    The bio is very long and I would like to manually insert line breaks within the bio using
    tags. However when I save it and view the page there is no line break the only way i managed to make it have a line space is by entering many   but it is not too effective.

    is there any solution for this?

    also is there a way to edit the fields when creating a user to have location, and city instead of aim, yahoo and jabber?

    thank you in advance!

  2. Kevin Kwok
    Member
    Posted 4 years ago #

    anyone anyone?

  3. exdesign
    Member
    Posted 4 years ago #

    I can't get paragraphs or breaks to work on one of my pages also. It keeps putting the next line right next to the previous one. What's up with that?

  4. Kevin Kwok
    Member
    Posted 4 years ago #

    i dunno =( it does the same thing for me.... i just put a bunch of spaces using   but it shows up different on every computer depending on their resolution so that solution does not really work....

  5. Kevin Kwok
    Member
    Posted 4 years ago #

    does someone happen to have a fix for this

  6. Kevin Kwok
    Member
    Posted 4 years ago #

    exdesign did you ever find out?

  7. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    How about a link?
    Are you using <br />?

  8. Kevin Kwok
    Member
    Posted 4 years ago #

    yes ive tried <BR /> <BR /> <BR /> and <p></p> and nothing works =(

    here is a link http://ampersandbox.net/?author=2
    notice under the author name theres a sentence or two. thats from the bio section when editing a user, i want to put line break within that section...but it wont work.

  9. Kevin Kwok
    Member
    Posted 4 years ago #

    ive tried hr tags as well still nothing...

  10. Kevin Kwok
    Member
    Posted 4 years ago #

    still cant figure this out.

  11. carlosmendoza
    Member
    Posted 4 years ago #

    To display the bio with format you have to process the contents of it first.

    Assuming you got the user data by using:

    $userdata = get_userdata(intval($author));

    The biographical info is in: $userdata->user_description, and to display it the way you want, apply the filter 'the_content' to it

    $user_description = apply_filters("the_content",$userdata->user_description);
    echo $user_description;

    This should display the bio with line breaks or the format you entered.

  12. Kevin Kwok
    Member
    Posted 4 years ago #

    Carlos! god bless you for replying =D

    this is how I called the user data

    <?php the_author_posts_link(); ?>
    <?php the_author_description(); ?>
    <a href="<?php the_author_url(); ?>" target="_blank"><?php the_author_url(); ?></a>

    unsure how to apply your fix =(

  13. Kevin Kwok
    Member
    Posted 4 years ago #

    ok i adjusted my code to fuse with yours

    <?php
    $the_author_description = apply_filters("the_content",$authordata->user_description);
    echo $the_author_description;?>

    it displays like before but now using your code, but line breaks still do not occur =(

  14. Kevin Kwok
    Member
    Posted 4 years ago #

    actually it does format, but only one line break, if i put two it will still only do one.

  15. carlosmendoza
    Member
    Posted 4 years ago #

    ok, give this a try:

    <?php
    $the_author_description = apply_filters("the_content",get_the_author_meta('description');
    echo $the_author_description;?>

    and for the line breaks, it's odd because in my test it works just like the main editor. Try adding a couple of

  16. carlosmendoza
    Member
    Posted 4 years ago #

    oops...

    forgot to add the backticks

    ... Try adding a couple of <br />

  17. parkersweb
    Member
    Posted 4 years ago #

    Have you tried this plugin?

    It should stop WordPress stripping out html from the biog. There's hacks like this one to achieve the same effect but I've not tried them.

  18. Kevin Kwok
    Member
    Posted 4 years ago #

    wish i knew about it earlier. carlos' fix above worked to some extent but overall there were too many problems to achieve what i wanted so i ended up using fields wordpress already created such as AIM YIM, etc etc. renaming those fields and just calling it to the author section that way i could add my line breaks within the php template and not in the author bio section of wordpress

  19. nicdvs
    Member
    Posted 4 years ago #

    Regarding the question on editing the fields of Authors page, here is an easy way to do it. You can add (or remove existing one (AIM, Jabber..) as many field as you want like Twitter, location...


    http://wpengineer.com/extend-user-contactinfo-wordpress-29/

    Hope this helps!

    And thanks for the bio formatting thing Carlos!

  20. Ben Dunkle
    Member
    Posted 3 years ago #

    $desc=nl2br ($curauth->description);
    echo $desc;

    will translate carriage returns into br tags. You probably don't want to give users too much control over formatting.

Topic Closed

This topic has been closed to new replies.

About this Topic