• Hi everyone,

    Im trying to display the excerpt on the main page of my blog. Which you can see here : http://hutchcreative.co.uk/rod/blog/

    I have added what I know to be the needed code but I cant seem to get it to work.

    Here is my php pulling in the excerpt

    <time datetime="<?php esc_attr_e( get_the_time( DATE_W3C ) ); ?>"><?php the_time( get_option( 'date_format' ) ); ?></time>
    	<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    	<?php if ( has_post_thumbnail() ) : ?>
    
    	<!-- figure -->
    	<a href="<?php the_permalink(); ?>" class="post-figure">
    
    		<!-- image -->
    		<?php the_post_thumbnail(); ?>
    
    	</a>
    	<!-- end: figure -->
    
    	<?php endif; ?>
    
    	<!-- info -->
    	<div class="post-info">
    
    		<?php if ( has_excerpt() ) : ?>
    
    		<?php the_excerpt(); ?>
    
    		<?php endif; ?>
    
    	</div>
    	<!-- end: info -->

    Here is my functions code:

    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    
    function sbt_auto_excerpt_more( $more ) {
    return ' ...';
    }
    add_filter( 'excerpt_more', 'sbt_auto_excerpt_more', 20 );
    
    function sbt_custom_excerpt_more( $output ) {return preg_replace('/<a[^>]+>Continue reading.*?<\/a>/i','',$output);
    }
    add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more', 20 );

    Thanks!

Viewing 1 replies (of 1 total)
  • Do you have excerpts manually added to each post? The has_excerpt() function will return true only if a manual excerpt exists. Try eliminating that test.

Viewing 1 replies (of 1 total)

The topic ‘Excerpt not showing’ is closed to new replies.