billerickson/display-posts-shortcode

Excerpts not working properly in 2.6.0 and 2.6.1

billerickson opened this issue · 2 comments

Summary: 2.6.2 fixes excerpt issues. I'm seeking opinions on how the new excerpt parameters are used

In 2.6.0 I introduced two new parameters for customizing excerpts: excerpt_more and excerpt_length. Unfortunately I didn't consider the customizations a theme will make to the excerpts, so this led to unexpected changes for some users who updated. See:

My goal is to never change your expected functionality in a new release. I obviously didn't test the changes in 2.6.0 well enough and I apologize.

After reviewing two themes referenced in the issues (Responsive and Aaron), I've modified (again) how Display Posts Shortcode handles excerpts, hopefully solving all these issues.

If you just specify include_excerpt="true", it will display the excerpt exactly as it did in 2.5.1. This allows the theme to customize the excerpt, solving the issues above.

If you specify an excerpt_length and/or an excerpt_more, I completely build the excerpt from scratch so that themes don't interfere with it. My assumption is you're specifying these parameters because you want to override what your current theme provides. If I didn't build it from scratch, you might end up with two "Read More" links - one from the theme and one from this plugin.

By default, WordPress makes no customizations to custom excerpts. If no custom excerpt is provided, it takes the post content, strips out HTML tags, and reduces it to a certain number of words and appends a "more" text (default is [...], but themes often change this).

If you use the excerpt_more parameter, I append that to every excerpt, regardless of whether it was manually specified or auto generated. This is different than WordPress' default behavior but in line with many themes (like Aaron and Responsive).

If you specify excerpt_length, I only use that for shortening auto-generated excerpts. Manually written excerpts are not shortened. I'm assuming that if you manually specify an excerpt, you don't want it shortened. This is in line with WordPress core as well as the themes I've reviewed.

I've also added an excerpt_more_link parameter. If you set that to true, the more text is a link to the post. This isn't a feature in WordPress but many themes link the excerpt more text.

As users of Display Posts Shortcode, please let me know your thoughts regarding these changes. I'm releasing the fixed version (2.6.2) today, but since no one is currently using the three new parameters (excerpt_length, excerpt_more, and excerpt_more_link) I'm comfortable changing how they work if my assumptions outlined above are wrong.

I want to make sure these new parameters are implemented the way most users expect them to work because once they start being used I won't want to change their default behavior.

I prefer you to override excerpt length even if already set or auto-generated.

I'd like the option not to display the link, at all.