Skip to content

Respect WordPress filters for the_excerpt in largo_excerpt #747

@wjhdev

Description

@wjhdev

This started as a discussion in Argo Links here.

There are several places where built in WordPress filters should work, but don't for whatever reason. One is largo_excerpt, which returns without applying the_excerpt filter. Another is largo_byline which does not apply filters such as the_author and the_author_posts_link. There's likely more.

The problem

As evident in Argo Links, without these filters, it's impossible to alter the content generated from these functions from a plugin (like wanting to replace the_excerpt entirely with something custom). We also don't have direct control over places like feeds where WordPress is going to use the_excerpt instead of largo_excerpt.

Secondly, with wanting to be as child theme-able as possible, I think it can be confuse to introduce so many extra "template" functions into our API. It would be nice if the_excerpt() was the excerpt and not different from largo_excerpt. Doing so gives developers less to juggle and ensures the special settings we apply in these functions aren't overwritten by inadvertent calls to the wrong place.

Possible solution

To continue using excerpts as an example, start depreciating calls to largo_excerpt() and fall back to the_excerpt(). No change in functionality should occur if we do something like this:

function largo_excerpt() {
  return the_excerpt();
}

function largo_filter_excerpt() {
  // return what used to be in largo_excerpt
} apply_filter('the_excerpt','largo_filter_excerpt',0);

Other things

  • We don't have a deprecation framework (something that will spit warnings when deprecated plugins are called), and WordPress's isn't really built to handle theme and plugin function deprecation. Modeling one after WordPress is probably a good place to start. Do we start to compile those functions in a depreciated.php? Or do we just keep 'em in place?
  • Are there other (to coin a term) WordPress-y ways to do things that could be folded into this issue?
  • This (at least in largo_byline and largo_excerpt) needs to be done to support argo links without partials/content-argolinks.php.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions