WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excerpt length: Line limit? (6 posts)

  1. MTPrower
    Member
    Posted 3 years ago #

    I have a child theme with a child functions.php.

    Is there a way to make the excerpt length x number of lines? I have a fluid site and I would like the excerpt length to stay at 5 lines at all times, so that no matter how wide or slim the site is, my style can look nice.

  2. MTPrower
    Member
    Posted 3 years ago #

    Never mind. I tricked my excerpts into being always the same height in a fluid layout with a combination of "height" and "overflow: hidden;"

    Thanks anyway.

  3. jcyyap
    Member
    Posted 2 years ago #

    hey friend!

    can you please tell me how?

    i want my excerpt to constantly stay 2 lines

    much appreciate it if you can tell me the secret =)

  4. MTPrower
    Member
    Posted 2 years ago #

    It requires some basic CSS coding. CSS is incredibly easy, and I think I have the right to make that statement, because I suck at coding in everything else.

    Basically, you give the excerpt box a max-height, and you give the excerpt text an overflow:hidden .

    If you need help, e-mail me at sonicreboot@gmail.com

    If you don't know anything about CSS, I suggest you start by using the Firefox web browser and installing the Firebug plugin from the official Firefox plugins page. Then go to your blog and right-click anything on your blog and click "Inspect Element". Take a good look at Firebug for a while, and screw around with the CSS code within the plugin so you can get an idea for how CSS works.

    You can then ask me for extra help if you want. Good luck!

  5. jcyyap
    Member
    Posted 2 years ago #

    thanks mate,

    i already have firebug installed and know a bit about CSS.

    so you enclosed the excerpt box within a div?

    thanks for a quick reply =)

  6. MTPrower
    Member
    Posted 2 years ago #

    Yes, you enclose it in a div. If you aren't good with HTML, there is a plugin, I think called "Better Excerpt", if I remember correctly, that would allow you to add code before and after the excerpt much more easily.

    You'll have to adjust the excerpt height manually so you don't clip any text, say, halfway. You may also have to find a creative way to end up with something that resembles a padding on the bottom, but that only depends on what the excerpt boxes look like.

Topic Closed

This topic has been closed to new replies.

About this Topic