studiopress / atomic-blocks

Atomic Blocks has been renamed to Genesis Blocks. This plugin is no longer maintained! Visit Atomic Blocks → Migrate to migrate to the new plugin.
https://wordpress.org/plugins/genesis-blocks/
GNU General Public License v3.0
157 stars 57 forks source link

Fixes issue where automatic excerpts are not displayed. #399

Closed mindctrl closed 4 years ago

mindctrl commented 4 years ago

The previous logic checked to see if the manual excerpt was empty before generating one automatically. The problem was when checking for a manual excerpt, it passed the data through the the_excerpt filter. In cases where themes or plugins filtered the_excerpt, this caused our empty check to assume there was a manual excerpt, therefore no automatic excerpt was generated. An example of where this can happen is with social sharing plugins that use the filter to add sharing links/buttons.

This changes the logic so that it passes the data through the_excerpt later, which avoids this issue.

Additional changes:

How to test

  1. Check out master branch.
  2. Configure the Post Grid block to show excerpts.
  3. Be sure some posts have manual excerpts and some do not have them.
  4. Note that excerpts should show as expected.
  5. Add the following code to your site and test excerpts again:
    add_action( 'the_excerpt', function( $excerpt ) {
    return 'moo ' . $excerpt;
    } );
  6. Note that automatic excerpts are broken.
  7. Check out this branch.
  8. Do above tests again.
  9. Be sure nothing else broke!

Suggested changelog entry