washingtonstateuniversity/WSUWP-spine-parent-theme

Note excerpt source

Closed this issue · 4 comments

I would be helpful to add a class on the article-summary wrapper denoting from whence the excerpt has been pulled in order to account for possible styling discrepancies within feeds with heterogenous excerpts.

https://github.com/washingtonstateuniversity/WSUWP-spine-parent-theme/blob/master/articles/post.php#L22

This was specifically raised by @charlesjdillon who is wrangling excerpts generated from "read-more" breaks (which come wrapped in TinyMCE's auto generated p tags) and custom crafted excerpts which arrive unadorned.

The classes might be something like break-excerpt, concatenated-excerpt, custom-exert, and content-excerpt.

Separately, @jeremyBass thought our excerpt logic to be a really good candidate for a function that could reside outside of the post.php template.

Just to clarify a minor point, it seemed to me that there may be benefit to moving the business logic in the template to the custom function used in the first meet condition , and just using the custom function to do that checks there? Just a thought to maybe simplify usage and maybe add options or other logic later on.

Could this be something where we could run wpautop() on the manual excerpt, or could that crush someone else's dreams who may be trying to sneak in unformatted content?

We can definitely abstract the logic. We aren't using it anywhere else now, but if we do provide a class based on the excerpt provided, things are going to get a little ugly for this template file.

We would probably need one function that gets the excerpt type - spine_get_excerpt_type(), which can be used to add the class. This can then be reused in spine_the_content() (or something) to determine what type of content to output.

Fixed in #166