On my static frontpage, I would like to fetch the two latest posts as shown in this link.

Now the posts should always be displayed like this (i.e. constant height, limited number of characters), no matter what! If the post uses the more-tag or not - it should always look like in the picture.

How can that be achieved?

I tried both content and excerpt but somehow there always are cases in which the layout gets messed up. Is there a 'standard' way of doing this?

(I'm just asking about getting the actual content, i.e. the "text text text" bit - I have done all the rest)

Many thanks

2 Answers 2


The simple way to do this is to define the height/width in CSS of a container, and then apply a trim on the excerpt.

To change default excerpt length add this to you functions.php

function new_excerpt_length($length) { 
    return 100; // change this to how many any characters you want

add_filter('excerpt_length', 'new_excerpt_length');

Manually controlling the excerpt How to control manual excerpt length?

Outside th loop Using wp_trim_excerpt to get the_excerpt() outside the loop

The same filters can be applied to the content, but the excerpt suits this better.


I think that because the excerpt limits words and not characters you will always get different heights. You can limit the excerpt to number of characters to make it more accurate:

function excerpt($num) {
    echo utf8_encode(substr(get_the_excerpt(), 0, $num+1)) . "...";

and then call it with:


this way you'll get the first 55 characters followed by ... overflow:hidded; may also help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.