Excerpts

Posted in: Newspaper
Post count: 84

Hello,

My old theme used the “the_excerpt()” function to control excerpt length and now I have discovered that this is not the way it’s done in the Newspaper theme. So now all my excerpts appear too long. I am fine with the control I have for the homepage but I would like to add the “the_excerpt()” for my categories. I am using M16 so it shouldn’t take much for me to add some code. Somebody already asked a similar question and you told them what to do so it should be easy. Thank you for your help.

  • This topic was modified 11 years by centennia.
Post count: 84

bump

Post count: 7909

Hi,

You can set the excerpt length for each module from Theme Panel > Excerpt section – http://screencast.com/t/xW6LP6ujaFO
If you want to create a condition for module 16 excerpt lenght only for category page you ca add it like this – http://screencast.com/t/IxPxKkZmukH

<?php
   if (is_category ()) {
      echo $this->get_excerpt(2);
}
   else{
      echo $this->get_excerpt();
}
?>

Result
– category – http://screencast.com/t/pHZCBvJkG4HX
– other template where module 16 is used – http://screencast.com/t/RGKvlVlYAhxE

Thanks!

Post count: 84

Not working, I’m afraid.

http://screencast.com/t/ICVeBxkkM

And I correctly used M16: http://screencast.com/t/uPsPS18O4Zf

  • This reply was modified 11 years by centennia.
Post count: 7909

Hi,

Please provide a link to category page where you use module 16 as it should work fine I have checked this again – http://screencast.com/t/CpRQeL61Hghttp://screencast.com/t/HMjSM7zqo Also please clear cache may it is a caching issue.

Thanks!

Post count: 84

I can’t provide you with a link because I am using a local installation. I found this other code, <?php echo wp_trim_words(get_the_excerpt(), 30); ?> , which I then put in M16 like this:

<div class=”td-excerpt”>
<?php echo wp_trim_words(get_the_excerpt(), 30); ?>
</div>

It works but I am not sure if it is good practice. Should I add anything else? Thanks!

Post count: 7909

Hi,

You can use it without any problems if it is working for you.

Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.