[Support request] How to create line breaks in the Author Box text.

Home Forums Support [Support request] How to create line breaks in the Author Box text.

Home Forums Support How to create line breaks in the Author Box text.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1160179
    Jodie

    Hi guys

    With your help I have this CSS in my additional CSS section in Customize.

    /*START of Author Box */
    .author-links a {
    font-size: 3em;
    line-height: 0.5em;
    float: right;
    }

    .author-box {
    padding: 4%;
    margin-top: 60px;
    font-size: 0.8em;
    }

    .author-box .avatar {
    width: 100px;
    border-radius: 100%;
    margin-right: 20px;
    float: left;
    }

    h5.author-title {
    margin-bottom: 0.5em;
    font-weight: 700;
    }

    .author-summary {
    overflow: hidden;
    }
    /* END of Author Box

    The text I have is in the WP section for Biographical information for my profile.
    I want to add line breaks so the text isn’t in one big block. I have tried placing html in that Biographical information box but it is not picked up.

    Have a look at the link I’ve given at the bottom of the post to see the Author box as it is now.

    Any suggestions?

    Thanks so much for your help as always.

    Cheers
    Jodie

    #1160377
    David
    Staff
    Customer Support

    Hi there,

    how is the author box added ? Are you using the plugin or a hook element ?

    #1161171
    Jodie

    Hi David. With a hook element as so

    <?php
    global $post;
    $author_id = $post->post_author;
    ?>

    <?php echo get_avatar( $author_id ); ?>

    <h5 class=”author-title”><?php printf( esc_attr__( ‘About %s’, ‘the author’ ), get_the_author_meta( ‘display_name’) );?></h5>

    <p class=”author-description”><?php echo wp_kses( get_the_author_meta( ‘description’ ), null ); ?></p>

    #1161185
    David
    Staff
    Customer Support

    Try replacing:

    <?php echo wp_kses( get_the_author_meta( ‘description’ ), null ); ?>

    with:

    <?php echo nl2br( get_the_author_meta( 'user_description' ) ); ?>

    This won’t display HTML such as <br /> tags but it should maintain any line breaks you have in the description

    #1161209
    Jodie

    Thanks very much David, I will try that.

    Cheers

    Jodie

    #1161214
    Jodie

    That worked. Thanks very much David.

    #1161224
    David
    Staff
    Customer Support

    Awesome – glad to hear that – i hadn’t tested it so much appreciated i am sure it’ll come in handy for others.

    #1161235
    Jodie

    So glad I could help you guys out in the process of you helping me 🙂

    Yes I hope it helps other too.

    Cheers.

    #1161594
    David
    Staff
    Customer Support

    I am sure it will 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.