Skip to content

Conversation

@raduconst
Copy link
Contributor

This PR is a fix for #25
The Toggle Post Details button was removed here 95c6874#diff-9163f1310b94e41b397251a77e18ec5a but the setup_postadata is still not working so I couldn't use the the_excerpt function.

What I did instead is try to replicate the functionality that's used on the Dashboard → Pages area and take care of these three cases:

  1. when the post is password protected, the There is no excerpt because this is a protected post. message is displayed (ref https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-includes/post-template.php#L400);
  2. when there's an excerpt set by the user, display it (ref https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-includes/post-template.php#L412);
  3. when there's no excerpt set, use wp_trim_words like explained here: https://developer.wordpress.org/reference/functions/get_the_excerpt/#comment-content-2457 Basically, this will generate automatically a text from the post content (ref. https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-includes/formatting.php#L3713).

I also made a little change on L474 and add the post-title class to the title column since the JS code that's adding the hidden class is still available.

@GaryJones
Copy link
Contributor

Closing in favor of PR #846, which has been merged.

The Toggle Post Details functionality from this PR was incorporated into #846 with the following enhancements:

  • Moved the toggle to Screen Options as a "Show post excerpts" checkbox
  • Added instant toggle via JavaScript (no page reload needed)
  • User preference saved to user meta and persists across sessions
  • Same excerpt logic: handles password-protected posts, custom excerpts, and auto-generated excerpts

Thank you @raduconst for the original implementation approach - the excerpt generation logic was used as the foundation for this feature.

@GaryJones GaryJones closed this Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants