Can't get the_excerpt() to work
-
Website link is:
https://xn--ernst-und-gabriele-mller-stiftung-bqd.de/Working on this website based off of the twenty-twelve theme. On the home page, towards the bottom, I’m trying to get recent blog posts to show up, truncated to some amount of characters. I have the following code in my functions.php file already:
function my_excerpt_length($length) { return 25; } add_filter('excerpt_length', 'my_excerpt_length');
and the following code is on my index.php file:
<?php if ( have_posts() ) : while ( have_posts() ) : the_excerpt(); ?> <div class="blogPost"> <div class="blogMeta"> <div class="blogDate"><?php the_time('d') ?><br /></div> <div class="blogMonth"><?php the_time('M') ?></div> </div> <div class="blogContent"> <?php get_template_part( 'content', get_post_format() ); ?> </div> </div> <?php endwhile; ?> <?php endif;
When I use the_post() on the third line there instead of the_excerpt(), it works and displays the full post. When I change it to the_excerpt(), it takes forever to load, and clearly is not behaving as I was hoping it would. This is what the homepage is currently set to, so you can see what it’s doing exactly.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Can't get the_excerpt() to work’ is closed to new replies.