WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Modifying html called by the_content (4 posts)

  1. brittanie
    Member
    Posted 6 years ago #

    It looks like the_content automatically puts a paragraph tags around the post. Is it possible to change this?

    I currently have posts that look like this:

    5:24 pm | 0 Comments |
    
    if you’re driving west in rush hour there are some amazing clouds right on the horizon right now

    and I would like to have it look like this:

    5:24 pm | 0 Comments | if you’re driving west in rush hour there are some amazing clouds right on the horizon right now

    where the content is on the same line as the meta data.

    Is this possible?

  2. Ryan Paul
    Member
    Posted 6 years ago #

    No you can't. I've come across this problem and never been able to fix it. Just have to modify your design to accomodate this... or use this:

    <?php echo substr(get_the_content(), 0, 150); ?>

    and change '150' to however many characters you want to show. But it WILL output the html code if you cut it off in the middle of an image or link.

  3. Justin Tadlock
    Member
    Posted 6 years ago #

    You'd have to float the time and comments line to the left and let the next paragraph wrap around it with CSS.

    It's not something I recommend, unless you know that you'll always use a paragraph as the first thing in your post.

  4. brittanie
    Member
    Posted 6 years ago #

    I'm only doing this for one category, using conditional tags, and I know that category will never have a post that starts with anything other than a paragraph. Thanks for your help, this worked really well.

Topic Closed

This topic has been closed to new replies.

About this Topic