tags:

views:

27

answers:

3

I cant use the_excerpt, because I need to grab the first, say 5 words, of the_content and style it differently.. but only on the first post on the page. Is there a way to do this? Thanks!

A: 

I pretty sure you can write a filter function in functions.php that manipulates the excerpt or content what ever way you want.

Derek Organ
+1  A: 

Oh wow twitter came through ;) Apparently there is a function to grab the content without it echoing out, so here is the link if anyone else stumbles on this. http://codex.wordpress.org/Function_Reference/get_the_content

thatryan
A: 

Yes, there is a filter for that.

function my_content_filter($the_content) {
    // fiddle with the content here

    // we only want to run once, so remove yourself right away
    remove_filter('the_content', 'my_content_filter', 10);

    return $the_content;
}

add_filter('the_content', 'my_content_filter', 10);

Use the is_home() function to do the appropriate checks if you only want this to run on the home page.

Gipetto