views:

20

answers:

2

Hey,

This is the mock up i have

http://img697.imageshack.us/img697/3172/featuresb.jpg

Each section will be an excerpt of a post that has a certain tag.

Is there any way of doing this so a client doesnt have to touch and tags or code like that.

Thank you

A: 

You could filter the content with your own function.

Instead of using <?php the_content() ?> its better to use this: <?php your_function(get_the_content()) ?>

The function can be put on functions.php and you are free to code.

Didats Triadi
A: 

You can use the_content filter like so,

add_filter('the_content', 'my_content_filter'); // 
function my_content_filter($content) {
    global $post;
    if($post->post_excerpt == ''){ // check if the post has excerpt
        $content = strip_tags($content);  //strip tags
        $cont_array = explode(' ',$content);
        if(count($cont_array) > 55)  //number of words wanted in excerpt default is 55
        $content = implode(' ',array_slice($cont_array, 0, 55)).'...';
        $content = '<p>'.$content.'</p>';
    }else{
        $content = $post->post_excerpt; //copy excerpt to content
    }
    return $content; //return content
}

The above code checks if the post has excerpt, if it has excerpt it returns excerpt else returns first 55 words (default length for excerpt).

Pragati Sureka