the_excerpt() just not working

Hi all,

I have a custom post type called ‘news’.

I have created an archive-news.php template which is a copy of index.php.

It calls templates/content-news.php via <?php get_template_part('templates/content', 'news'); ?>

Everything works (title, thumbnail, date, content) except the_excerpt();

Any help with this would be much appreciated.

Need some more details:

  • Describe how it doesn’t work - what are you seeing instead of the expected behavior?
  • What’s your code for registering the post type?

Did you register the post type with support for excerpt?

Hi Ben,

This is still an issue.

I have created a custom post type called “News”.

It has ‘post’ capabilities, it supports ‘excerpt’.

Each post shows fine on the single page. When I visit /news (the archive page - I have not created a template Im just letting it fall back to the default) it shows the title, the entry meta and “…continued” but no excerpt text.

If i replace the_excerpt() in content.php with the_content(), the full article is printed out.

Really stumped by this. Any help would be appreciated.

Is the_excerpt() working for built in post types?

Hi cfx,

Thanks for your reply.

No, it is exhibiting the same behaviour on default post types - just the ellipses and continue.

Regards

If you have any plugins installed please disable them all and re-check your CPT and default post types.

Also, if you have any custom filters or modified the Roots cleanup.php file, specifically the_excerpt filter then please comment those out and test again.

1 Like

CFX you are a champion.

I dont like tying Google Analytics code to my theme so I commented out the code in config.php

Of course, I accidentally commented out the POST_EXCERPT_LENGTH definition while I was at it, causing the problem.

Many thanks for your help, it is very much appreciated.

Happy to help, glad you got it working!