Dean
asked 9 years ago

Hi there DW

How can I change excerpt of posts shown on the homepage? I am using your DW Post Query widget. I could not find option/code inside widget.php file.

1 Answers
DominicStaff
answered 9 years ago

Hi,
If you want to change the excerpt size, you can add the following code to the style.css file:
.entry-summary { font-size: 10px; }
Hope this helps !

deanl
replied 9 years ago

Hi Dominic. Will this change font size? I was thinking to change size of excerpt – how many words are shown. At the moment excerpt is rather long, maybe 20 words, I would like to keep it at only 10 words.

Also when I tried to change "continue reading" at the end of excerpt to something else "read more", it didn’t work. There is a option in DW Post Query widget to change that, but for some reason it does not work for me. Can you please check if this working on your side? Or maybe there is a different way to change this?

dominic Staff
replied 9 years ago

To resolve this issue, you can add the following code to the functions.php file:

function get_excerpt($count){
  $permalink = get_permalink($post->ID);
  $excerpt = get_the_content();
  $excerpt = strip_tags($excerpt);
  $excerpt = substr($excerpt, 0, $count);
  $excerpt = $excerpt.'... <a href="'.$permalink.'">Read More...</a>';
  return $excerpt;
}

Then open the widgets.php file, line 119.
Replace the following code:
<div class="entry-summary"><?php echo get_the_excerpt(); ?></div>

With new code:
<div class="entry-summary"><?php echo get_excerpt(10); ?></div>

Hope this helps !

deanl
replied 9 years ago

Great, thanks Dominic.

Powered by DW Question & Answer Pro