• Ive created a page which has a list of all my blog posts but im having a little trouble getting it to do what i want.

    I want the page to display a list of my blog posts then separate them into page of 10 at a time, ie page 1 2 3 4 5 etc etc

    I would like the featured image on the right then the exert text of 500 characters on the right, i have style this as such.

    Problem i have is:
    1) how do i remove any images from the content so the exert just shows the text from the post and no the images (as i have a feature image)
    2) how do i make an exert of 500 characters with a read more link??
    3) split the posts into pages of 10 posts.

    my code is?

    <div class="post-entry <?php if ($thumb_small <> '') {echo "timbg";} ?>">
    
    				<?php if($thumb_small<>'') { ?>
    
    		<a class="featuredimage1" href="<?php the_permalink() ?>"><img src="<?php echo $thumb_small[0]; ?>" alt="<?php the_title(); ?>" /></a>
    
    		<?php } ?>
    
    			<?php the_content( __( '<span class="read-more">Read More</span>', 'Hero' ), $stripteaser  ); ?>
    			<div class="clear"></div>
    			<?php wp_link_pages( array( 'before' => '' . __( 'Pages:' ), 'after' => '' ) ); ?>
    
    				</div><!--post-entry end-->

    followed by the comments code

    thanks

Viewing 1 replies (of 1 total)
  • Copy and paste the following script in your functions.php. If you understand a little bit of Php, you can tweak the script below to your needs:

    if ( ! function_exists( 'foundation_excerpt' ) ) :
    
    function foundation_excerpt($text) {
            global $post;
            if ( '' == $text ) {
                    $text = get_the_content('');
                    $text = apply_filters('the_content', $text);
                    $text = str_replace('\]\]\>', ']]>', $text);
                    $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
                    $text = strip_tags($text, '<p>');
                    $excerpt_length = 13;
                    $words = explode(' ', $text, $excerpt_length + 1);
                    if (count($words) > $excerpt_length) {
                            array_pop($words);
                            array_push($words, '...'); //and some dots
                            //array_push($words, '<br><br><a href="'.get_permalink($post->ID) .'" class="button secondary small">' . __('Continue Reading', 'foundation') . '</a>');
                            $text = implode(' ', $words);
                    }
            }
            return $text;
    }
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'foundation_excerpt');
    
    endif;

    It works similarly to what you want – but not 100%. It has everything you need, just not fine tuned

Viewing 1 replies (of 1 total)
  • The topic ‘how? Remove images and create excert for a blog real’ is closed to new replies.